Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c8f5512

Browse files
committed
Update/tidy test_rcparams.py and move mpl.rc to test_rcparams.rc.
1 parent 45cba0f commit c8f5512

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

lib/matplotlib/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,7 @@ def tk_window_focus():
10681068
'matplotlib.tests.test_mathtext',
10691069
'matplotlib.tests.test_mlab',
10701070
'matplotlib.tests.test_patches',
1071+
'matplotlib.tests.test_rcparams',
10711072
'matplotlib.tests.test_simplification',
10721073
'matplotlib.tests.test_spines',
10731074
'matplotlib.tests.test_text',

lib/matplotlib/tests/mpl.rc

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/matplotlib/tests/test_rcparams.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
mpl.rc('text', usetex=False)
55
mpl.rc('lines', linewidth=22)
66

7-
fname = os.path.abspath(os.path.dirname(__file__)) + os.sep + 'mpl.rc'
8-
7+
fname = os.path.join(os.path.dirname(__file__), 'test_rcparams.rc')
8+
99
def test_rcparams():
1010

1111
usetex = mpl.rcParams['text.usetex']
@@ -27,8 +27,11 @@ def test_rcparams():
2727
assert mpl.rcParams['lines.linewidth'] == linewidth
2828

2929
# test rc_file
30-
mpl.rc_file(fname)
31-
assert mpl.rcParams['lines.linewidth'] == 33
30+
try:
31+
mpl.rc_file(fname)
32+
assert mpl.rcParams['lines.linewidth'] == 33
33+
finally:
34+
mpl.rcParams['lines.linewidth'] = linewidth
3235

3336

3437
if __name__ == '__main__':

lib/matplotlib/tests/test_rcparams.rc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# this file is used by the tests in test_rcparams.py
2+
3+
lines.linewidth: 33

0 commit comments

Comments
 (0)