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