@@ -424,14 +424,25 @@ def test_rcparams_reset_after_fail():
424
424
assert mpl .rcParams ['text.usetex' ] is False
425
425
426
426
427
- def test_if_rctemplate_is_up_to_date ():
427
+ @pytest .fixture
428
+ def mplrc ():
429
+ # This is the Fedora-specific location ...
430
+ if 'MATPLOTLIBDATA' in os .environ :
431
+ # ... in buildroot.
432
+ return os .path .join (os .environ ['MATPLOTLIBDATA' ],
433
+ '../../../../etc/matplotlibrc' )
434
+ else :
435
+ # ... on installed systems.
436
+ return '/etc/matplotlibrc'
437
+
438
+
439
+ def test_if_rctemplate_is_up_to_date (mplrc ):
428
440
# This tests if the matplotlibrc.template file
429
441
# contains all valid rcParams.
430
442
dep1 = mpl ._all_deprecated
431
443
dep2 = mpl ._deprecated_set
432
444
deprecated = list (dep1 .union (dep2 ))
433
- path_to_rc = os .path .join (mpl .get_data_path (), 'matplotlibrc' )
434
- with open (path_to_rc , "r" ) as f :
445
+ with open (mplrc , "r" ) as f :
435
446
rclines = f .readlines ()
436
447
missing = {}
437
448
for k , v in mpl .defaultParams .items ():
@@ -453,11 +464,10 @@ def test_if_rctemplate_is_up_to_date():
453
464
.format (missing .items ()))
454
465
455
466
456
- def test_if_rctemplate_would_be_valid (tmpdir ):
467
+ def test_if_rctemplate_would_be_valid (tmpdir , mplrc ):
457
468
# This tests if the matplotlibrc.template file would result in a valid
458
469
# rc file if all lines are uncommented.
459
- path_to_rc = os .path .join (mpl .get_data_path (), 'matplotlibrc' )
460
- with open (path_to_rc , "r" ) as f :
470
+ with open (mplrc , "r" ) as f :
461
471
rclines = f .readlines ()
462
472
newlines = []
463
473
for line in rclines :
0 commit comments