Skip to content

Commit

Permalink
MAINT: retain support for pytest<3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
pv committed May 27, 2018
1 parent 74047a6 commit 261fb52
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Expand Up @@ -114,7 +114,7 @@ jobs:
export PATH=/usr/lib/ccache:$PATH
# XXX: use "numpy>=1.15.0" when it's released
pypy3 -mpip install --upgrade pip setuptools wheel
pypy3 -mpip install --no-build-isolation --extra-index https://antocuni.github.io/pypy-wheels/ubuntu "pytest>=3.6" pytest-xdist Tempita "Cython>=0.28.2" mpmath
pypy3 -mpip install --no-build-isolation --extra-index https://antocuni.github.io/pypy-wheels/ubuntu pytest pytest-xdist Tempita "Cython>=0.28.2" mpmath
pypy3 -mpip install --no-build-isolation git+https://github.com/numpy/numpy.git@db552b5b6b37f2ff085b304751d7a2ebed26adc9
- run:
name: build
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -102,7 +102,7 @@ before_install:
- travis_retry pip install --upgrade pip setuptools wheel
- travis_retry pip install cython==0.25.2
- if [ -n "$NUMPYSPEC" ]; then travis_retry pip install $NUMPYSPEC; fi
- travis_retry pip install --upgrade "pytest>=3.6.0" pytest-xdist pytest-faulthandler mpmath argparse Pillow codecov
- travis_retry pip install --upgrade pytest pytest-xdist pytest-faulthandler mpmath argparse Pillow codecov
- travis_retry pip install gmpy2 # speeds up mpmath (scipy.special tests)
- |
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
Expand Down
6 changes: 5 additions & 1 deletion scipy/conftest.py
Expand Up @@ -5,12 +5,16 @@
import pytest
import warnings

from distutils.version import LooseVersion
from scipy._lib._fpumode import get_fpu_mode
from scipy._lib._testutils import FPUModeChangeWarning


def pytest_runtest_setup(item):
mark = item.get_closest_marker("xslow")
if LooseVersion(pytest.__version__) >= LooseVersion("3.6.0"):
mark = item.get_closest_marker("xslow")
else:
mark = item.get_marker("xslow")
if mark is not None:
try:
v = int(os.environ.get('SCIPY_XSLOW', '0'))
Expand Down
15 changes: 11 additions & 4 deletions scipy/sparse/tests/test_base.py
Expand Up @@ -22,6 +22,7 @@ class for generic tests" section.
import operator
import contextlib
import functools
from distutils.version import LooseVersion

import numpy as np
from scipy._lib.six import xrange, zip as izip
Expand Down Expand Up @@ -4499,10 +4500,16 @@ def cases_64bit():
if bool(msg):
marks += [pytest.mark.skip(reason=msg)]

markers = getattr(method, 'pytestmark', [])
for mark in markers:
if mark.name in ('skipif', 'skip', 'xfail', 'xslow'):
marks.append(mark)
if LooseVersion(pytest.__version__) >= LooseVersion("3.6.0"):
markers = getattr(method, 'pytestmark', [])
for mark in markers:
if mark.name in ('skipif', 'skip', 'xfail', 'xslow'):
marks.append(mark)
else:
for mname in ['skipif', 'skip', 'xfail', 'xslow']:
if hasattr(method, mname):
marks += [getattr(method, mname)]

yield pytest.param(cls, method_name, marks=marks)


Expand Down
2 changes: 1 addition & 1 deletion tools/ci/appveyor/requirements.txt
@@ -1,6 +1,6 @@
numpy
cython
pytest>=3.6.0
pytest
pytest-timeout
pytest-xdist
pytest-env
Expand Down

0 comments on commit 261fb52

Please sign in to comment.