2
2
3
3
import six
4
4
5
+ from collections import OrderedDict
6
+ import copy
7
+ from itertools import chain
5
8
import os
6
9
import warnings
7
- from collections import OrderedDict
8
10
9
11
from cycler import cycler , Cycler
10
12
import pytest
16
18
import matplotlib as mpl
17
19
import matplotlib .pyplot as plt
18
20
import matplotlib .colors as mcolors
19
- from itertools import chain
20
21
import numpy as np
21
22
from matplotlib .rcsetup import (validate_bool_maybe_none ,
22
23
validate_stringlist ,
31
32
_validate_linestyle )
32
33
33
34
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 )
38
40
39
41
40
42
def test_rcparams ():
41
43
usetex = mpl .rcParams ['text.usetex' ]
42
44
linewidth = mpl .rcParams ['lines.linewidth' ]
45
+ fname = os .path .join (os .path .dirname (__file__ ), 'test_rcparams.rc' )
43
46
44
47
# test context given dictionary
45
48
with mpl .rc_context (rc = {'text.usetex' : not usetex }):
@@ -57,9 +60,8 @@ def test_rcparams():
57
60
assert mpl .rcParams ['lines.linewidth' ] == linewidth
58
61
59
62
# 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
63
65
64
66
65
67
def test_RcParams_class ():
@@ -135,8 +137,7 @@ def test_Bug_2543():
135
137
mpl .rcParams [key ] = _copy [key ]
136
138
mpl .rcParams ['text.dvipnghack' ] = None
137
139
with mpl .rc_context ():
138
- from copy import deepcopy
139
- _deep_copy = deepcopy (mpl .rcParams )
140
+ _deep_copy = copy .deepcopy (mpl .rcParams )
140
141
# real test is that this does not raise
141
142
assert validate_bool_maybe_none (None ) is None
142
143
assert validate_bool_maybe_none ("none" ) is None
0 commit comments