@@ -44,40 +44,23 @@ def wrapped_func(**kw):
44
44
raise RuntimeError ("Thread raised a warning" )
45
45
46
46
47
- def test_setting_within_context ():
47
+ @pytest .mark .parametrize ("with_context" , [True , False ])
48
+ @pytest .mark .parametrize (
49
+ "prop, options" ,
50
+ [
51
+ ("font.size" , list (range (10 ))),
52
+ ("abc" , "A. a. aa aaa aaaa." .split ()),
53
+ ],
54
+ )
55
+ def test_setting_without_context (prop , options , with_context ):
48
56
"""
49
57
Test the thread safety of a context setting
50
58
"""
51
- # We spawn workers and these workers should try to set
52
- # an arbitrarry rc parameter. This should
53
- # be local to that context and not affect the main thread.
54
- prop , value = "font.size" , uplt .rc ["font.size" ]
55
- options = list (range (10 ))
56
- _spawn_and_run_threads (
57
- modify_rc_on_thread , prop = prop , options = options , with_context = True
58
- )
59
- assert uplt .rc [prop ] == value
60
-
61
-
62
- def test_setting_without_context ():
63
- """
64
- Test the thread safety of a context setting
65
- """
66
- # We spawn workers and these workers should try to set
67
- # an arbitrarry rc parameter. This should
68
- # be local to that context and not affect the main thread.
69
- #
70
- # Test an ultraplot parameter
71
- prop = "abc"
72
59
value = uplt .rc [prop ]
73
- options = "A. a. aa aaa aaaa." .split ()
74
60
_spawn_and_run_threads (
75
- modify_rc_on_thread , prop = prop , options = options , with_context = False
61
+ modify_rc_on_thread ,
62
+ prop = prop ,
63
+ options = options ,
64
+ with_context = with_context ,
76
65
)
77
66
assert uplt .rc [prop ] == value
78
-
79
- prop , value = "font.size" , uplt .rc ["font.size" ]
80
- options = list (range (10 ))
81
- _spawn_and_run_threads (
82
- modify_rc_on_thread , prop = prop , options = options , with_context = False
83
- )
0 commit comments