Skip to content

Commit 33aa68c

Browse files
committed
Investigate test failures.
1 parent 39df421 commit 33aa68c

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

lib/matplotlib/tests/test_rcparams.py

+12-11
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33

44
import six
55

6+
from collections import OrderedDict
7+
import copy
68
import io
9+
from itertools import chain
710
import os
811
import warnings
9-
from collections import OrderedDict
1012

1113
from cycler import cycler, Cycler
1214
import pytest
@@ -18,7 +20,6 @@
1820
import matplotlib as mpl
1921
import matplotlib.pyplot as plt
2022
import matplotlib.colors as mcolors
21-
from itertools import chain
2223
import numpy as np
2324
from matplotlib.rcsetup import (validate_bool_maybe_none,
2425
validate_stringlist,
@@ -33,15 +34,17 @@
3334
_validate_linestyle)
3435

3536

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

4143

4244
def test_rcparams():
4345
usetex = mpl.rcParams['text.usetex']
4446
linewidth = mpl.rcParams['lines.linewidth']
47+
fname = os.path.join(os.path.dirname(__file__), 'test_rcparams.rc')
4548

4649
# test context given dictionary
4750
with mpl.rc_context(rc={'text.usetex': not usetex}):
@@ -59,9 +62,8 @@ def test_rcparams():
5962
assert mpl.rcParams['lines.linewidth'] == linewidth
6063

6164
# test rc_file
62-
with mpl.rc_context():
63-
mpl.rc_file(fname)
64-
assert mpl.rcParams['lines.linewidth'] == 33
65+
mpl.rc_file(fname)
66+
assert mpl.rcParams['lines.linewidth'] == 33
6567

6668

6769
def test_RcParams_class():
@@ -154,8 +156,7 @@ def test_Bug_2543():
154156
mpl.rcParams[key] = _copy[key]
155157
mpl.rcParams['text.dvipnghack'] = None
156158
with mpl.rc_context():
157-
from copy import deepcopy
158-
_deep_copy = deepcopy(mpl.rcParams)
159+
_deep_copy = copy.deepcopy(mpl.rcParams)
159160
# real test is that this does not raise
160161
assert validate_bool_maybe_none(None) is None
161162
assert validate_bool_maybe_none("none") is None

0 commit comments

Comments
 (0)