diff --git a/.travis.yml b/.travis.yml index 871e176ff0..6ebe0821fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -94,9 +94,10 @@ before_install: install: - travis_retry pip install $EXTRA_PIP_FLAGS -e .[$NIPYPE_EXTRAS] +- travis_retry pip install pytest-xdist script: -- py.test -v --cov nipype --cov-config .coveragerc --cov-report xml:cov.xml -c nipype/pytest.ini --doctest-modules nipype +- py.test -v --cov nipype --cov-config .coveragerc --cov-report xml:cov.xml -c nipype/pytest.ini --doctest-modules nipype -n auto after_script: - codecov --file cov.xml --flags unittests -e TRAVIS_JOB_NUMBER diff --git a/docker/files/run_pytests.sh b/docker/files/run_pytests.sh index 24d9466f80..c3d33f2f53 100644 --- a/docker/files/run_pytests.sh +++ b/docker/files/run_pytests.sh @@ -29,6 +29,7 @@ export COVERAGE_FILE=${WORKDIR}/tests/.coverage.py${PYTHON_VERSION} py.test -v --junitxml=${WORKDIR}/tests/pytests_py${PYTHON_VERSION}.xml \ --cov nipype --cov-config /src/nipype/.coveragerc \ --cov-report xml:${WORKDIR}/tests/coverage_py${PYTHON_VERSION}.xml \ + -n auto \ -c ${TESTPATH}/pytest.ini ${TESTPATH} exit_code=$? diff --git a/docker/generate_dockerfiles.sh b/docker/generate_dockerfiles.sh index 9c281f8bbc..cbe26d05a8 100755 --- a/docker/generate_dockerfiles.sh +++ b/docker/generate_dockerfiles.sh @@ -92,7 +92,7 @@ function generate_main_dockerfile() { conda_install='python=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} icu=58.1 libxml2 libxslt matplotlib mkl numpy paramiko pandas psutil scikit-learn scipy traits=4.6.0' \ - pip_install="grabbit==0.1.2 https://github.com/INCF/pybids/tarball/0.6.5" \ + pip_install="pytest-xdist" \ activate=true \ --copy docker/files/run_builddocs.sh docker/files/run_examples.sh \ docker/files/run_pytests.sh nipype/external/fsl_imglob.py /usr/bin/ \ diff --git a/nipype/__init__.py b/nipype/__init__.py index ad961e7df4..172617e887 100644 --- a/nipype/__init__.py +++ b/nipype/__init__.py @@ -25,17 +25,22 @@ class NipypeTester(object): - def __call__(self, doctests=True, parallel=True): + def __call__(self, doctests=True, parallel=False): try: import pytest - except: + except ImportError: raise RuntimeError( 'py.test not installed, run: pip install pytest') args = [] if not doctests: args.extend(['-p', 'no:doctest']) - if not parallel: - args.append('-n0') + if parallel: + try: + import xdist + except ImportError: + raise RuntimeError( + "pytest-xdist required for parallel run") + args.append('-n auto') args.append(os.path.dirname(__file__)) pytest.main(args=args) diff --git a/nipype/info.py b/nipype/info.py index 7b1a757789..2dd5489e0a 100644 --- a/nipype/info.py +++ b/nipype/info.py @@ -109,7 +109,6 @@ def get_nipype_gitversion(): SCIPY_MIN_VERSION = '0.14' TRAITS_MIN_VERSION = '4.6' DATEUTIL_MIN_VERSION = '2.2' -PYTEST_MIN_VERSION = '3.6' FUTURE_MIN_VERSION = '0.16.0' SIMPLEJSON_MIN_VERSION = '3.8.0' PROV_VERSION = '1.5.2' @@ -149,19 +148,16 @@ def get_nipype_gitversion(): 'neurdflib', 'click>=%s' % CLICK_MIN_VERSION, 'funcsigs', - 'mock', 'pydotplus', 'pydot>=%s' % PYDOT_MIN_VERSION, 'packaging', 'futures; python_version == "2.7"', + 'configparser; python_version <= "3.4"', ] -if sys.version_info <= (3, 4): - REQUIRES.append('configparser') - TESTS_REQUIRES = [ - 'pytest>=%s' % PYTEST_MIN_VERSION, - 'pytest-xdist', + 'mock', + 'pytest', 'pytest-cov', 'codecov', 'pytest-env', diff --git a/nipype/pytest.ini b/nipype/pytest.ini index 70f12b64aa..c5706c3f75 100644 --- a/nipype/pytest.ini +++ b/nipype/pytest.ini @@ -1,6 +1,6 @@ [pytest] norecursedirs = .git build dist doc nipype/external tools examples src -addopts = --doctest-modules -n auto +addopts = --doctest-modules doctest_optionflags = ALLOW_UNICODE NORMALIZE_WHITESPACE env = PYTHONHASHSEED=0 diff --git a/requirements.txt b/requirements.txt index 1d1a4d1f9c..0d951f49c0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,10 +11,6 @@ neurdflib click>=6.6.0 funcsigs configparser -pytest>=3.0 -pytest-xdist -pytest-env -mock pydotplus pydot>=1.2.3 packaging