Skip to content

Commit 56d99ed

Browse files
committed
tests.py should now act more like the old nose version did,
using pytest. also fixed up problem in test_labeled_data_unpacking, relating to '==' on two lines.
1 parent 1e7b62c commit 56d99ed

File tree

3 files changed

+21
-17
lines changed

3 files changed

+21
-17
lines changed

lib/matplotlib/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,21 +1515,22 @@ def _init_tests():
15151515
"Expect many image comparison failures below.")
15161516

15171517
try:
1518-
import nose
1518+
# import nose
15191519
try:
15201520
from unittest import mock
15211521
except:
15221522
import mock
15231523
except ImportError:
1524-
print("matplotlib.test requires nose and mock to run.")
1524+
print("matplotlib.test requires mock to run. nose is currently being removed")
15251525
raise
15261526

15271527

15281528
def _get_extra_test_plugins():
1529-
from .testing.noseclasses import KnownFailure
1530-
from nose.plugins import attrib
1529+
# from .testing.noseclasses import KnownFailure
1530+
# from nose.plugins import attrib
15311531

1532-
return [KnownFailure, attrib.Plugin]
1532+
#return [KnownFailure, attrib.Plugin]
1533+
pass
15331534

15341535

15351536
def _get_nose_env():

lib/matplotlib/tests/test_labeled_data_unpacking.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,8 @@ def funcy(ax, *args, **kwargs):
346346

347347
# the normal case...
348348
data = {"x": "X", "hy1": "Y"}
349-
assert funcy(None, "x", "hy1", data=data) ==
350-
"('X', 'Y') | {}"
351-
assert funcy(None, "x", "hy1", "c", data=data) ==
352-
"('X', 'Y', 'c') | {}"
349+
assert funcy(None, "x", "hy1", data=data) == "('X', 'Y') | {}"
350+
assert funcy(None, "x", "hy1", "c", data=data) == "('X', 'Y', 'c') | {}"
353351

354352
# no arbitrary long args with data
355353
def f():

tests.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@
1616
import matplotlib
1717
matplotlib.use('agg')
1818

19-
import nose
19+
# import nose
20+
import pytest
2021
from matplotlib import default_test_modules
2122

2223

2324
def run(extra_args):
24-
from nose.plugins import multiprocess
25+
# from nose.plugins import multiprocess
2526

2627
env = matplotlib._get_nose_env()
2728

@@ -30,13 +31,17 @@ def run(extra_args):
3031
# Nose doesn't automatically instantiate all of the plugins in the
3132
# child processes, so we have to provide the multiprocess plugin with
3233
# a list.
33-
plugins = matplotlib._get_extra_test_plugins()
34-
multiprocess._instantiate_plugins = plugins
34+
# plugins = matplotlib._get_extra_test_plugins()
35+
# multiprocess._instantiate_plugins = plugins
3536

36-
nose.main(addplugins=[x() for x in plugins],
37-
defaultTest=default_test_modules,
38-
argv=sys.argv + extra_args,
39-
env=env)
37+
# nose.main(addplugins=[x() for x in plugins],
38+
# defaultTest=default_test_modules,
39+
# argv=sys.argv + extra_args,
40+
# env=env)
41+
42+
argv = sys.argv + extra_args
43+
for test_module in default_test_modules:
44+
pytest.main(' '.join(argv[1:]) + ' ' + " --pyargs %s" % test_module)
4045

4146
if __name__ == '__main__':
4247
extra_args = []

0 commit comments

Comments
 (0)