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

Skip to content

Commit 9964e8e

Browse files
Update test_rcparams.py
1 parent a67b9d0 commit 9964e8e

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

lib/matplotlib/tests/test_rcparams.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -454,10 +454,10 @@ def test_if_rctemplate_is_up_to_date():
454454
.format(missing.items()))
455455

456456

457-
def test_if_rctemplate_would_be_valid():
457+
def test_if_rctemplate_would_be_valid(tmpdir):
458458
# This tests if the matplotlibrc.template file would result in a valid
459459
# rc file if all lines are uncommented.
460-
path_to_rc = mpl.matplotlib_fname()
460+
path_to_rc = "matplotlibrc.txt" #mpl.matplotlib_fname() #
461461
with open(path_to_rc, "r") as f:
462462
rclines = f.readlines()
463463
newlines = []
@@ -471,17 +471,15 @@ def test_if_rctemplate_would_be_valid():
471471
if "datapath" in newline:
472472
newline = ""
473473
newlines.append(newline)
474-
#print(os.path.dirname(__file__))
475-
fname = os.path.join(os.path.dirname(__file__),
476-
'testrcvalid.temp')
474+
d = tmpdir.mkdir('test1')
475+
fname = str(d.join('testrcvalid.temp'))
477476
with open(fname, "w") as f:
478477
f.writelines(newlines)
479478
with pytest.warns(None) as record:
480479
dic = mpl.rc_params_from_file(fname,
481480
fail_on_error=True,
482481
use_default_template=False)
483482
assert len(record) == 0
484-
os.remove(fname)
485483
#d1 = set(dic.keys())
486484
#d2 = set(matplotlib.defaultParams.keys())
487485
#print(d2-d1)

0 commit comments

Comments
 (0)