Skip to content

Commit a0c571b

Browse files
authored
Merge pull request #10929 from QuLogic/rctemplate-path
TST: Fix rctemplate tests when user config file exists.
2 parents 509bec1 + 1c934f0 commit a0c571b

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

lib/matplotlib/tests/test_rcparams.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -430,12 +430,11 @@ def test_if_rctemplate_is_up_to_date():
430430
dep1 = mpl._all_deprecated
431431
dep2 = mpl._deprecated_set
432432
deprecated = list(dep1.union(dep2))
433-
#print(deprecated)
434-
path_to_rc = mpl.matplotlib_fname()
433+
path_to_rc = os.path.join(mpl.get_data_path(), 'matplotlibrc')
435434
with open(path_to_rc, "r") as f:
436435
rclines = f.readlines()
437436
missing = {}
438-
for k,v in mpl.defaultParams.items():
437+
for k, v in mpl.defaultParams.items():
439438
if k[0] == "_":
440439
continue
441440
if k in deprecated:
@@ -447,7 +446,7 @@ def test_if_rctemplate_is_up_to_date():
447446
if k in line:
448447
found = True
449448
if not found:
450-
missing.update({k:v})
449+
missing.update({k: v})
451450
if missing:
452451
raise ValueError("The following params are missing " +
453452
"in the matplotlibrc.template file: {}"
@@ -457,7 +456,7 @@ def test_if_rctemplate_is_up_to_date():
457456
def test_if_rctemplate_would_be_valid(tmpdir):
458457
# This tests if the matplotlibrc.template file would result in a valid
459458
# rc file if all lines are uncommented.
460-
path_to_rc = mpl.matplotlib_fname()
459+
path_to_rc = os.path.join(mpl.get_data_path(), 'matplotlibrc')
461460
with open(path_to_rc, "r") as f:
462461
rclines = f.readlines()
463462
newlines = []
@@ -476,10 +475,7 @@ def test_if_rctemplate_would_be_valid(tmpdir):
476475
with open(fname, "w") as f:
477476
f.writelines(newlines)
478477
with pytest.warns(None) as record:
479-
dic = mpl.rc_params_from_file(fname,
480-
fail_on_error=True,
481-
use_default_template=False)
478+
mpl.rc_params_from_file(fname,
479+
fail_on_error=True,
480+
use_default_template=False)
482481
assert len(record) == 0
483-
#d1 = set(dic.keys())
484-
#d2 = set(matplotlib.defaultParams.keys())
485-
#print(d2-d1)

pytest.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ pep8ignore =
5656
matplotlib/tests/test_image.py E225 E231 E251 E302 E303 E501
5757
matplotlib/tests/test_lines.py E231 E261
5858
matplotlib/tests/test_mathtext.py E261 E302 E501
59-
matplotlib/tests/test_rcparams.py E231
6059
matplotlib/tri/triinterpolate.py E201 E221
6160
matplotlib/_cm.py E101 E202 E203 W191
6261
matplotlib/_mathtext_data.py E203 E231 E261

0 commit comments

Comments
 (0)