From 3720651085e3b3876b1d1828c3739821a02e7e5a Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Sat, 12 Jan 2019 14:50:45 -0500 Subject: [PATCH 1/9] Remove pytest from requirements.txt which duplicates requirements --- requirements.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 1d1a4d1f9c..560a72ca38 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,9 +11,6 @@ neurdflib click>=6.6.0 funcsigs configparser -pytest>=3.0 -pytest-xdist -pytest-env mock pydotplus pydot>=1.2.3 From 8a168d96c7fc8c57b81521e0ae8b2f0329d4d0db Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 14 Jan 2019 12:18:52 -0500 Subject: [PATCH 2/9] RF: move mock into tests_requires --- nipype/info.py | 2 +- requirements.txt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/nipype/info.py b/nipype/info.py index 5780b71e1d..db3d1d73a4 100644 --- a/nipype/info.py +++ b/nipype/info.py @@ -147,7 +147,6 @@ def get_nipype_gitversion(): 'neurdflib', 'click>=%s' % CLICK_MIN_VERSION, 'funcsigs', - 'mock', 'pydotplus', 'pydot>=%s' % PYDOT_MIN_VERSION, 'packaging', @@ -158,6 +157,7 @@ def get_nipype_gitversion(): REQUIRES.append('configparser') TESTS_REQUIRES = [ + 'mock', 'pytest>=%s' % PYTEST_MIN_VERSION, 'pytest-xdist', 'pytest-cov', diff --git a/requirements.txt b/requirements.txt index 560a72ca38..0d951f49c0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,7 +11,6 @@ neurdflib click>=6.6.0 funcsigs configparser -mock pydotplus pydot>=1.2.3 packaging From 0161e814a6488b0a210b6e598227321032d9e728 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 16 Jan 2019 16:25:25 -0500 Subject: [PATCH 3/9] RF: Drop pytest-xdist requirement, minimum pytest version --- nipype/__init__.py | 11 ++++++++--- nipype/info.py | 4 +--- nipype/pytest.ini | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/nipype/__init__.py b/nipype/__init__.py index ad961e7df4..9e0cb5b1e0 100644 --- a/nipype/__init__.py +++ b/nipype/__init__.py @@ -25,16 +25,21 @@ 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: + if parallel: + try: + import xdist + except ImportError: + raise RuntimeError( + "pytest-xdist required for parallel run") args.append('-n0') args.append(os.path.dirname(__file__)) pytest.main(args=args) diff --git a/nipype/info.py b/nipype/info.py index f87883380f..91ac0b0b76 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' @@ -160,8 +159,7 @@ def get_nipype_gitversion(): TESTS_REQUIRES = [ 'mock', - 'pytest>=%s' % PYTEST_MIN_VERSION, - 'pytest-xdist', + '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 From fb0801a42a7b19ece2084e981914883260ab0ce1 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 16 Jan 2019 16:31:11 -0500 Subject: [PATCH 4/9] CI: Install pytest-xdist in CI for speed --- .travis.yml | 5 ++++- docker/files/run_pytests.sh | 1 + docker/generate_dockerfiles.sh | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 871e176ff0..5b3f937e44 100644 --- a/.travis.yml +++ b/.travis.yml @@ -95,8 +95,11 @@ before_install: install: - travis_retry pip install $EXTRA_PIP_FLAGS -e .[$NIPYPE_EXTRAS] +after_install: +- 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..8b35cea2f8 100755 --- a/docker/generate_dockerfiles.sh +++ b/docker/generate_dockerfiles.sh @@ -108,6 +108,8 @@ function generate_main_dockerfile() { --miniconda use_env=neuro \ pip_opts="-e" \ pip_install="/src/nipype[all]" \ + --miniconda use_env=neuro \ + pip_install="pytest-xdist" \ --workdir /work \ --label org.label-schema.build-date='$BUILD_DATE' \ org.label-schema.name="NIPYPE" \ From b7a12488b4f5b513b23f8562ed8724f349f077f4 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 16 Jan 2019 16:38:39 -0500 Subject: [PATCH 5/9] MAINT: Move configparser to PEP508 style --- nipype/info.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nipype/info.py b/nipype/info.py index 91ac0b0b76..2dd5489e0a 100644 --- a/nipype/info.py +++ b/nipype/info.py @@ -152,11 +152,9 @@ def get_nipype_gitversion(): '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 = [ 'mock', 'pytest', From c3fc35ab6eca14876b5f041b2d6cede7f8f53b97 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Thu, 17 Jan 2019 10:18:51 -0500 Subject: [PATCH 6/9] CI: after_install isn't a thing Stop trying to make it a thing. --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5b3f937e44..6ebe0821fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -94,8 +94,6 @@ before_install: install: - travis_retry pip install $EXTRA_PIP_FLAGS -e .[$NIPYPE_EXTRAS] - -after_install: - travis_retry pip install pytest-xdist script: From be9bc9c6d426c6b166b4eac2dc69df0e21de0ff2 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Fri, 18 Jan 2019 09:26:25 -0500 Subject: [PATCH 7/9] Update nipype/__init__.py --- nipype/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/__init__.py b/nipype/__init__.py index 9e0cb5b1e0..eca783c7d0 100644 --- a/nipype/__init__.py +++ b/nipype/__init__.py @@ -40,7 +40,7 @@ def __call__(self, doctests=True, parallel=False): except ImportError: raise RuntimeError( "pytest-xdist required for parallel run") - args.append('-n0') + args.append('-n auto') args.append(os.path.dirname(__file__)) pytest.main(args=args) From 12fe2b9bdc30be58f6e005200c8f822016cff554 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Fri, 18 Jan 2019 09:26:48 -0500 Subject: [PATCH 8/9] Update nipype/__init__.py --- nipype/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/__init__.py b/nipype/__init__.py index eca783c7d0..172617e887 100644 --- a/nipype/__init__.py +++ b/nipype/__init__.py @@ -40,7 +40,7 @@ def __call__(self, doctests=True, parallel=False): except ImportError: raise RuntimeError( "pytest-xdist required for parallel run") - args.append('-n auto') + args.append('-n auto') args.append(os.path.dirname(__file__)) pytest.main(args=args) From 50e2f47d5c2e9fb6ddacd113d4c4d187b604ed46 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sun, 20 Jan 2019 10:20:28 -0500 Subject: [PATCH 9/9] CI: Move pytest-xdist installation --- docker/generate_dockerfiles.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docker/generate_dockerfiles.sh b/docker/generate_dockerfiles.sh index 8b35cea2f8..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/ \ @@ -108,8 +108,6 @@ function generate_main_dockerfile() { --miniconda use_env=neuro \ pip_opts="-e" \ pip_install="/src/nipype[all]" \ - --miniconda use_env=neuro \ - pip_install="pytest-xdist" \ --workdir /work \ --label org.label-schema.build-date='$BUILD_DATE' \ org.label-schema.name="NIPYPE" \