Skip to content

Commit d0e61d7

Browse files
committed
TST: raise nose.SkipTest -> pytest.skip
TST: remove KnownFailure (unused), should be replaced by pytest.xfail anyhow TST: remove nose xref pandas-dev#15341
1 parent 3f7d2db commit d0e61d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+389
-519
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,5 +331,5 @@ after_script:
331331
- echo "after_script start"
332332
- ci/install_test.sh
333333
- source activate pandas && python -c "import pandas; pandas.show_versions();"
334-
- ci/print_skipped.py /tmp/nosetests.xml
334+
- ci/print_skipped.py /tmp/pytest.xml
335335
- echo "after_script done"

ci/install_test.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ if [ "$INSTALL_TEST" ]; then
88
conda uninstall cython || exit 1
99
python "$TRAVIS_BUILD_DIR"/setup.py sdist --formats=zip,gztar || exit 1
1010
pip install "$TRAVIS_BUILD_DIR"/dist/*tar.gz || exit 1
11-
# nosetests --exe -A "$TEST_ARGS" pandas/tests/test_series.py --with-xunit --xunit-file=/tmp/nosetests_install.xml
1211
pytest pandas/tests/test_series.py --junitxml=/tmp/pytest_install.xml
1312
else
1413
echo "Skipping installation test."

ci/install_travis.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,7 @@ if [ -e ${INSTALL} ]; then
9292
time bash $INSTALL || exit 1
9393
else
9494
# create new env
95-
time conda create -n pandas python=$PYTHON_VERSION nose pytest || exit 1
96-
97-
if [ "$LINT" ]; then
98-
conda install flake8
99-
pip install cpplint
100-
fi
95+
time conda create -n pandas python=$PYTHON_VERSION pytest || exit 1
10196
fi
10297

10398
# build deps
@@ -116,6 +111,12 @@ fi
116111

117112
source activate pandas
118113

114+
pip install pytest-xdist
115+
if [ "$LINT" ]; then
116+
conda install flake8
117+
pip install cpplint
118+
fi
119+
119120
if [ "$COVERAGE" ]; then
120121
pip install coverage pytest-cov
121122
fi

ci/lint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ if [ "$LINT" ]; then
5555
echo "Linting *.c and *.h DONE"
5656

5757
echo "Check for invalid testing"
58-
grep -r -E --include '*.py' --exclude nosetester.py --exclude testing.py '(numpy|np)\.testing' pandas
58+
grep -r -E --include '*.py' --exclude testing.py '(numpy|np)\.testing' pandas
5959
if [ $? = "0" ]; then
6060
RET=1
6161
fi

ci/requirements_all.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
nose
21
pytest
32
pytest-cov
3+
pytest-xdist
44
flake8
55
sphinx
66
ipython

ci/requirements_dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ python-dateutil
22
pytz
33
numpy
44
cython
5-
nose
65
pytest
76
pytest-cov
7+
pytest-xdist
88
flake8

ci/script.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ if [ -n "$LOCALE_OVERRIDE" ]; then
1818
fi
1919

2020
if [ "$BUILD_TEST" ]; then
21-
echo "We are not running nosetests as this is simply a build test."
21+
echo "We are not running pytest as this is simply a build test."
2222
elif [ "$COVERAGE" ]; then
23-
echo pytest -s --cov=pandas --cov-report xml:/tmp/nosetests.xml $TEST_ARGS pandas
24-
pytest -s --cov=pandas --cov-report xml:/tmp/nosetests.xml $TEST_ARGS pandas
23+
echo pytest -s --cov=pandas --cov-report xml:/tmp/pytest.xml $TEST_ARGS pandas
24+
pytest -s --cov=pandas --cov-report xml:/tmp/pytest.xml $TEST_ARGS pandas
2525
else
2626
echo pytest $TEST_ARGS pandas
2727
pytest $TEST_ARGS pandas # TODO: doctest

doc/source/contributing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ gbq integration tests on a forked repository:
734734
the status by visiting your Travis branches page which exists at the
735735
following location: https://travis-ci.org/your-user-name/pandas/branches .
736736
Click on a build job for your branch. Expand the following line in the
737-
build log: ``ci/print_skipped.py /tmp/nosetests.xml`` . Search for the
737+
build log: ``ci/print_skipped.py /tmp/pytest.xml`` . Search for the
738738
term ``test_gbq`` and confirm that gbq integration tests are not skipped.
739739

740740
Running the vbench performance test suite (phasing out)

pandas/computation/tests/test_compat.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# flake8: noqa
33

4-
import nose
4+
import pytest
55
from itertools import product
66
from distutils.version import LooseVersion
77

@@ -31,7 +31,7 @@ def test_compat():
3131
assert _NUMEXPR_INSTALLED
3232

3333
except ImportError:
34-
raise nose.SkipTest("not testing numexpr version compat")
34+
pytest.skip("not testing numexpr version compat")
3535

3636

3737
def test_invalid_numexpr_version():
@@ -49,14 +49,14 @@ def testit():
4949
try:
5050
import numexpr as ne
5151
except ImportError:
52-
raise nose.SkipTest("no numexpr")
52+
pytest.skip("no numexpr")
5353
else:
5454
if ne.__version__ < LooseVersion('2.1'):
5555
with tm.assertRaisesRegexp(ImportError, "'numexpr' version is "
5656
".+, must be >= 2.1"):
5757
testit()
5858
elif ne.__version__ == LooseVersion('2.4.4'):
59-
raise nose.SkipTest("numexpr version==2.4.4")
59+
pytest.skip("numexpr version==2.4.4")
6060
else:
6161
testit()
6262
else:

pandas/computation/tests/test_eval.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
from itertools import product
77
from distutils.version import LooseVersion
88

9-
import nose
10-
from nose.tools import assert_raises
9+
import pytest
1110

1211
from numpy.random import randn, rand, randint
1312
import numpy as np
@@ -319,7 +318,7 @@ def get_expected_pow_result(self, lhs, rhs):
319318
except ValueError as e:
320319
if str(e).startswith('negative number cannot be raised to a fractional power'):
321320
if self.engine == 'python':
322-
raise nose.SkipTest(str(e))
321+
pytest.skip(str(e))
323322
else:
324323
expected = np.nan
325324
else:
@@ -1174,13 +1173,15 @@ def test_bool_ops_with_constants(self):
11741173
def test_panel_fails(self):
11751174
x = Panel(randn(3, 4, 5))
11761175
y = Series(randn(10))
1177-
assert_raises(NotImplementedError, self.eval, 'x + y',
1176+
with pytest.raises(NotImplementedError):
1177+
self.eval('x + y',
11781178
local_dict={'x': x, 'y': y})
11791179

11801180
def test_4d_ndarray_fails(self):
11811181
x = randn(3, 4, 5, 6)
11821182
y = Series(randn(10))
1183-
assert_raises(NotImplementedError, self.eval, 'x + y',
1183+
with pytest.raises(NotImplementedError):
1184+
self.eval('x + y',
11841185
local_dict={'x': x, 'y': y})
11851186

11861187
def test_constant(self):
@@ -1705,7 +1706,7 @@ def test_result_types(self):
17051706

17061707
def test_result_types2(self):
17071708
# xref https://github.com/pandas-dev/pandas/issues/12293
1708-
raise nose.SkipTest("unreliable tests on complex128")
1709+
pytest.skip("unreliable tests on complex128")
17091710

17101711
# Did not test complex64 because DataFrame is converting it to
17111712
# complex128. Due to https://github.com/pandas-dev/pandas/issues/10952
@@ -1822,7 +1823,8 @@ def check_disallowed_nodes(engine, parser):
18221823
inst = VisitorClass('x + 1', engine, parser)
18231824

18241825
for ops in uns_ops:
1825-
assert_raises(NotImplementedError, getattr(inst, ops))
1826+
with pytest.raises(NotImplementedError):
1827+
getattr(inst, ops)()
18261828

18271829

18281830
def test_disallowed_nodes():
@@ -1833,7 +1835,8 @@ def test_disallowed_nodes():
18331835
def check_syntax_error_exprs(engine, parser):
18341836
tm.skip_if_no_ne(engine)
18351837
e = 's +'
1836-
assert_raises(SyntaxError, pd.eval, e, engine=engine, parser=parser)
1838+
with pytest.raises(SyntaxError):
1839+
pd.eval(e, engine=engine, parser=parser)
18371840

18381841

18391842
def test_syntax_error_exprs():

0 commit comments

Comments
 (0)