3
3
4
4
import six
5
5
6
+ from collections import OrderedDict
7
+ import copy
6
8
import io
9
+ from itertools import chain
7
10
import os
8
11
import warnings
9
- from collections import OrderedDict
10
12
11
13
from cycler import cycler , Cycler
12
14
import pytest
18
20
import matplotlib as mpl
19
21
import matplotlib .pyplot as plt
20
22
import matplotlib .colors as mcolors
21
- from itertools import chain
22
23
import numpy as np
23
24
from matplotlib .rcsetup import (validate_bool_maybe_none ,
24
25
validate_stringlist ,
33
34
_validate_linestyle )
34
35
35
36
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 )
40
42
41
43
42
44
def test_rcparams ():
43
45
usetex = mpl .rcParams ['text.usetex' ]
44
46
linewidth = mpl .rcParams ['lines.linewidth' ]
47
+ fname = os .path .join (os .path .dirname (__file__ ), 'test_rcparams.rc' )
45
48
46
49
# test context given dictionary
47
50
with mpl .rc_context (rc = {'text.usetex' : not usetex }):
@@ -59,9 +62,8 @@ def test_rcparams():
59
62
assert mpl .rcParams ['lines.linewidth' ] == linewidth
60
63
61
64
# 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
65
67
66
68
67
69
def test_RcParams_class ():
@@ -154,8 +156,7 @@ def test_Bug_2543():
154
156
mpl .rcParams [key ] = _copy [key ]
155
157
mpl .rcParams ['text.dvipnghack' ] = None
156
158
with mpl .rc_context ():
157
- from copy import deepcopy
158
- _deep_copy = deepcopy (mpl .rcParams )
159
+ _deep_copy = copy .deepcopy (mpl .rcParams )
159
160
# real test is that this does not raise
160
161
assert validate_bool_maybe_none (None ) is None
161
162
assert validate_bool_maybe_none ("none" ) is None
0 commit comments