Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita4427a1

Browse files
committed
Fix running of tests without installation.
* Check for installed test data only if testing installed package.* Remove relative import out of tests.* Replace assert_str_equal with plain assert (pytest does diffing already).
1 parent5bc91c7 commita4427a1

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

‎lib/matplotlib/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,9 +1488,6 @@ def _init_tests():
14881488
else:
14891489
faulthandler.enable()
14901490

1491-
ifnotos.path.isdir(os.path.join(os.path.dirname(__file__),'tests')):
1492-
raiseImportError("matplotlib test data is not installed")
1493-
14941491
# The version of FreeType to install locally for running the
14951492
# tests. This must match the value in `setupext.py`
14961493
LOCAL_FREETYPE_VERSION='2.6.1'
@@ -1526,6 +1523,8 @@ def test(verbosity=None, coverage=False, switch_backend_warn=True,
15261523
recursionlimit=0,**kwargs):
15271524
"""run the matplotlib test suite"""
15281525
_init_tests()
1526+
ifnotos.path.isdir(os.path.join(os.path.dirname(__file__),'tests')):
1527+
raiseImportError("matplotlib test data is not installed")
15291528

15301529
old_backend=get_backend()
15311530
old_recursionlimit=sys.getrecursionlimit()

‎lib/matplotlib/tests/test_preprocess_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
importpytest
66

7-
from..import_preprocess_data
7+
frommatplotlibimport_preprocess_data
88

99

1010
# Notes on testing the plotting functions itself

‎lib/matplotlib/tests/test_rcparams.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
importmock
1818
importmatplotlibasmpl
1919
importmatplotlib.pyplotasplt
20-
frommatplotlib.testsimportassert_str_equal
2120
importmatplotlib.colorsasmcolors
2221
fromitertoolsimportchain
2322
importnumpyasnp
@@ -93,7 +92,7 @@ def test_RcParams_class():
9392
u'font.size': 12.0,
9493
u'font.weight': u'normal'})""".lstrip()
9594

96-
assert_str_equal(expected_repr,repr(rc))
95+
assertexpected_repr==repr(rc)
9796

9897
ifsix.PY3:
9998
expected_str="""
@@ -108,7 +107,7 @@ def test_RcParams_class():
108107
font.size: 12.0
109108
font.weight: normal""".lstrip()
110109

111-
assert_str_equal(expected_str,str(rc))
110+
assertexpected_str==str(rc)
112111

113112
# test the find_all functionality
114113
assert ['font.cursive','font.size']==sorted(rc.find_all('i[vz]'))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp