Skip to content

Commit

Permalink
Merge pull request scipy#8871 from RonnyPfannschmidt/address-8866
Browse files Browse the repository at this point in the history
TST: correctly iterate pytest mark metadata

Instead of marker objects, markerinfo objects where pushed into the mark
pipeline. This would silently work on pytest releases <3.6, but for >=3.6 breaks 
due to fixing bugs in markers.

Check pytest version, and use the correct way to do things for >=3.6.0 but
use the old code for older pytest versions.
  • Loading branch information
pv authored May 27, 2018
2 parents 49e0454 + 261fb52 commit b44bff6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
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.5,!=3.6.0" 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
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +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
# For now (2018/05/25) we prevent using pytest 3.6 for all CIs as it has a bug, See gh-8866
- travis_retry pip install --upgrade "pytest>=3.5,!=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
Original file line number Diff line number Diff line change
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_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: 12 additions & 3 deletions scipy/sparse/tests/test_base.py
Original file line number Diff line number Diff line change
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 @@ -4498,9 +4499,17 @@ def cases_64bit():
msg = SKIP_TESTS.get(method_name)
if bool(msg):
marks += [pytest.mark.skip(reason=msg)]
for mname in ['skipif', 'skip', 'xfail', 'xslow']:
if hasattr(method, mname):
marks += [getattr(method, mname)]

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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
numpy
cython
pytest>=3.5,!=3.6.0
pytest
pytest-timeout
pytest-xdist
pytest-env
Expand Down

0 comments on commit b44bff6

Please sign in to comment.