Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ following rules before you submit a pull request:
[task list](https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments)
in the PR description.

- All tests pass when running `nosetests`. On
- All tests pass when running `pytest`. On
Unix-like systems, check with (from the toplevel source folder):

```bash
$ nosetests
$ pytest
```

For Windows systems, execute the command from an Anaconda Prompt or add `nosetests` to PATH before executing the command.
For Windows systems, execute the command from an Anaconda Prompt or add `pytest` to PATH before executing the command.

- Documentation and high-coverage tests are necessary for enhancements to be
accepted. Bug-fixes or new features should be provided with
Expand All @@ -101,8 +101,8 @@ tools:
- Code with good unittest **coverage** (at least 80%), check with:

```bash
$ pip install nose coverage
$ nosetests --with-coverage path/to/tests_for_package
$ pip install pytest pytest-cov
$ pytest --cov=. path/to/tests_for_package
```

- No pyflakes warnings, check with:
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

PYTHON ?= python
CYTHON ?= cython
NOSETESTS ?= nosetests
PYTEST ?= pytest
CTAGS ?= ctags

all: clean inplace test
Expand All @@ -16,12 +16,12 @@ inplace:
$(PYTHON) setup.py build_ext -i

test-code: in
$(NOSETESTS) -s -v tests
$(PYTEST) -s -v tests
test-doc:
$(NOSETESTS) -s -v doc/*.rst
$(PYTEST) -s -v doc/*.rst

test-coverage:
rm -rf coverage .coverage
$(NOSETESTS) -s -v --with-coverage tests
$(PYTEST) -s -v --cov=. tests

test: test-code test-sphinxext test-doc
6 changes: 3 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ install:
# Install the build and runtime dependencies of the project.
- "cd C:\\projects\\openml-python"
- conda install --quiet --yes scikit-learn=0.18.2
- conda install --quiet --yes mock numpy scipy nose requests nbformat python-dateutil nbconvert pandas matplotlib seaborn
- conda install --quiet --yes mock numpy scipy pytest requests nbformat python-dateutil nbconvert pandas matplotlib seaborn
- pip install liac-arff xmltodict oslo.concurrency
- "python setup.py install" #%CMD_IN_ENV%
- "pip install .[test]"


# Not a .NET project, we build scikit-learn in the install step instead
build: false

test_script:
- "cd C:\\projects\\openml-python"
- "%CMD_IN_ENV% python setup.py test"
- "%CMD_IN_ENV% pytest"
2 changes: 1 addition & 1 deletion ci_scripts/create_doc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if ! [[ -z ${DOCPUSH+x} ]]; then
if [[ "$DOCPUSH" == "true" ]]; then

# install documentation building dependencies
pip install --upgrade matplotlib seaborn setuptools nose coverage sphinx pillow sphinx-gallery sphinx_bootstrap_theme cython numpydoc nbformat nbconvert
pip install matplotlib seaborn sphinx pillow sphinx-gallery sphinx_bootstrap_theme cython numpydoc nbformat nbconvert

# $1 is the branch name
# $2 is the global variable where we set the script status
Expand Down
6 changes: 3 additions & 3 deletions ci_scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ popd
# provided versions
conda create -n testenv --yes python=$PYTHON_VERSION pip
source activate testenv
pip install nose numpy scipy cython scikit-learn==$SKLEARN_VERSION \
pip install pytest pytest-xdist pytest-timeout numpy scipy cython scikit-learn==$SKLEARN_VERSION \
oslo.concurrency

if [[ "$EXAMPLES" == "true" ]]; then
Expand All @@ -37,10 +37,10 @@ if [[ "$DOCTEST" == "true" ]]; then
pip install pandas sphinx_bootstrap_theme
fi
if [[ "$COVERAGE" == "true" ]]; then
pip install codecov
pip install codecov pytest-cov
fi

python --version
python -c "import numpy; print('numpy %s' % numpy.__version__)"
python -c "import scipy; print('scipy %s' % scipy.__version__)"
python setup.py develop
pip install -e '.[test]'
4 changes: 2 additions & 2 deletions ci_scripts/success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ set -e

if [[ "$COVERAGE" == "true" ]]; then
# Need to run coveralls from a git checkout, so we copy .coverage
# from TEST_DIR where nosetests has been run
# from TEST_DIR where pytest has been run
cp $TEST_DIR/.coverage $TRAVIS_BUILD_DIR
cd $TRAVIS_BUILD_DIR
# Ignore coveralls failures as the coveralls server is not
# very reliable but we don't want travis to report a failure
# in the github UI just because the coverage report failed to
# be published.
codecov || echo "Codecov upload failed"
fi
fi
12 changes: 8 additions & 4 deletions ci_scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ doctest_dir=$cwd/doc
cd $TEST_DIR

if [[ "$EXAMPLES" == "true" ]]; then
nosetests -sv $test_dir/test_examples/
pytest -sv $test_dir/test_examples/
elif [[ "$DOCTEST" == "true" ]]; then
python -m doctest $doctest_dir/usage.rst
elif [[ "$COVERAGE" == "true" ]]; then
nosetests --processes=4 --process-timeout=600 -sv --ignore-files="test_OpenMLDemo\.py" --with-coverage --cover-package=$MODULE $test_dir
fi

if [[ "$COVERAGE" == "true" ]]; then
PYTEST_ARGS='--cov=openml'
else
nosetests --processes=4 --process-timeout=600 -sv --ignore-files="test_OpenMLDemo\.py" $test_dir
PYTEST_ARGS=''
fi

pytest -n 4 --timeout=600 --timeout-method=thread -sv --ignore='test_OpenMLDemo.py' $PYTEST_ARGS $test_dir
2 changes: 1 addition & 1 deletion doc/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ From within the directory of the cloned package, execute:

.. code:: bash

nosetests tests/
pytest tests/

.. _extending:

Expand Down
9 changes: 8 additions & 1 deletion openml/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,14 @@ def setUp(self):

def tearDown(self):
os.chdir(self.cwd)
shutil.rmtree(self.workdir)
try:
shutil.rmtree(self.workdir)
except PermissionError:
if os.name == 'nt':
# one of the files may still be used by another process
pass
else:
raise
openml.config.server = self.production_server

def _add_sentinel_to_flow_name(self, flow, sentinel=None):
Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
'scipy>=0.13.3',
'liac-arff>=2.2.2',
'xmltodict',
'nose',
'pytest',
'requests',
'scikit-learn>=0.18',
'nbformat',
Expand All @@ -49,10 +49,11 @@
extras_require={
'test': [
'nbconvert',
'jupyter_client'
'jupyter_client',
'matplotlib'
]
},
test_suite="nose.collector",
test_suite="pytest",
classifiers=['Intended Audience :: Science/Research',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ deps =
scipy > 0.9
pandas > 0.13.1
xmltodict
nose
pytest
mock
commands=
python setup.py install
Expand Down