Skip to content

Commit ff0577f

Browse files
committed
Investigate test failures.
1 parent 0b1cb95 commit ff0577f

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

lib/matplotlib/tests/test_rcparams.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
import six
44

5+
from collections import OrderedDict
6+
import copy
7+
from itertools import chain
58
import os
69
import warnings
7-
from collections import OrderedDict
810

911
from cycler import cycler, Cycler
1012
import pytest
@@ -16,7 +18,6 @@
1618
import matplotlib as mpl
1719
import matplotlib.pyplot as plt
1820
import matplotlib.colors as mcolors
19-
from itertools import chain
2021
import numpy as np
2122
from matplotlib.rcsetup import (validate_bool_maybe_none,
2223
validate_stringlist,
@@ -31,15 +32,17 @@
3132
_validate_linestyle)
3233

3334

34-
mpl.rc('text', usetex=False)
35-
mpl.rc('lines', linewidth=22)
36-
37-
fname = os.path.join(os.path.dirname(__file__), 'test_rcparams.rc')
35+
@pytest.fixture(autouse=True)
36+
def setup_module():
37+
with mpl.rc_context():
38+
mpl.rc('text', usetex=False)
39+
mpl.rc('lines', linewidth=22)
3840

3941

4042
def test_rcparams():
4143
usetex = mpl.rcParams['text.usetex']
4244
linewidth = mpl.rcParams['lines.linewidth']
45+
fname = os.path.join(os.path.dirname(__file__), 'test_rcparams.rc')
4346

4447
# test context given dictionary
4548
with mpl.rc_context(rc={'text.usetex': not usetex}):
@@ -57,9 +60,8 @@ def test_rcparams():
5760
assert mpl.rcParams['lines.linewidth'] == linewidth
5861

5962
# test rc_file
60-
with mpl.rc_context():
61-
mpl.rc_file(fname)
62-
assert mpl.rcParams['lines.linewidth'] == 33
63+
mpl.rc_file(fname)
64+
assert mpl.rcParams['lines.linewidth'] == 33
6365

6466

6567
def test_RcParams_class():
@@ -135,8 +137,7 @@ def test_Bug_2543():
135137
mpl.rcParams[key] = _copy[key]
136138
mpl.rcParams['text.dvipnghack'] = None
137139
with mpl.rc_context():
138-
from copy import deepcopy
139-
_deep_copy = deepcopy(mpl.rcParams)
140+
_deep_copy = copy.deepcopy(mpl.rcParams)
140141
# real test is that this does not raise
141142
assert validate_bool_maybe_none(None) is None
142143
assert validate_bool_maybe_none("none") is None

0 commit comments

Comments
 (0)