@@ -75,14 +75,14 @@ def test_register_option(self):
75
75
def test_describe_option (self ):
76
76
cf .register_option ("a" , 1 , "doc" )
77
77
cf .register_option ("b" , 1 , "doc2" )
78
- cf .deprecate_option ("b" )
78
+ cf .deprecate_option ("b" , FutureWarning )
79
79
80
80
cf .register_option ("c.d.e1" , 1 , "doc3" )
81
81
cf .register_option ("c.d.e2" , 1 , "doc4" )
82
82
cf .register_option ("f" , 1 )
83
83
cf .register_option ("g.h" , 1 )
84
84
cf .register_option ("k" , 2 )
85
- cf .deprecate_option ("g.h" , rkey = "k" )
85
+ cf .deprecate_option ("g.h" , FutureWarning , rkey = "k" )
86
86
cf .register_option ("l" , "foo" )
87
87
88
88
# non-existent keys raise KeyError
@@ -111,7 +111,8 @@ def test_describe_option(self):
111
111
cf .set_option ("l" , "bar" )
112
112
assert "bar" in cf .describe_option ("l" , _print_desc = False )
113
113
114
- def test_case_insensitive (self ):
114
+ @pytest .mark .parametrize ("category" , [DeprecationWarning , FutureWarning ])
115
+ def test_case_insensitive (self , category ):
115
116
cf .register_option ("KanBAN" , 1 , "doc" )
116
117
117
118
assert "doc" in cf .describe_option ("kanbaN" , _print_desc = False )
@@ -124,9 +125,9 @@ def test_case_insensitive(self):
124
125
with pytest .raises (OptionError , match = msg ):
125
126
cf .get_option ("no_such_option" )
126
127
127
- cf .deprecate_option ("KanBan" )
128
+ cf .deprecate_option ("KanBan" , category )
128
129
msg = "'kanban' is deprecated, please refrain from using it."
129
- with pytest .raises (FutureWarning , match = msg ):
130
+ with pytest .raises (category , match = msg ):
130
131
cf .get_option ("kAnBaN" )
131
132
132
133
def test_get_option (self ):
@@ -285,7 +286,7 @@ def test_reset_option_all(self):
285
286
286
287
def test_deprecate_option (self ):
287
288
# we can deprecate non-existent options
288
- cf .deprecate_option ("foo" )
289
+ cf .deprecate_option ("foo" , FutureWarning )
289
290
290
291
with tm .assert_produces_warning (FutureWarning , match = "deprecated" ):
291
292
with pytest .raises (KeyError , match = "No such keys.s.: 'foo'" ):
@@ -295,15 +296,15 @@ def test_deprecate_option(self):
295
296
cf .register_option ("b.c" , "hullo" , "doc2" )
296
297
cf .register_option ("foo" , "hullo" , "doc2" )
297
298
298
- cf .deprecate_option ("a" , removal_ver = "nifty_ver" )
299
+ cf .deprecate_option ("a" , FutureWarning , removal_ver = "nifty_ver" )
299
300
with tm .assert_produces_warning (FutureWarning , match = "eprecated.*nifty_ver" ):
300
301
cf .get_option ("a" )
301
302
302
303
msg = "Option 'a' has already been defined as deprecated"
303
304
with pytest .raises (OptionError , match = msg ):
304
- cf .deprecate_option ("a" )
305
+ cf .deprecate_option ("a" , FutureWarning )
305
306
306
- cf .deprecate_option ("b.c" , "zounds!" )
307
+ cf .deprecate_option ("b.c" , FutureWarning , "zounds!" )
307
308
with tm .assert_produces_warning (FutureWarning , match = "zounds!" ):
308
309
cf .get_option ("b.c" )
309
310
@@ -313,7 +314,7 @@ def test_deprecate_option(self):
313
314
assert cf .get_option ("d.a" ) == "foo"
314
315
assert cf .get_option ("d.dep" ) == "bar"
315
316
316
- cf .deprecate_option ("d.dep" , rkey = "d.a" ) # reroute d.dep to d.a
317
+ cf .deprecate_option ("d.dep" , FutureWarning , rkey = "d.a" ) # reroute d.dep to d.a
317
318
with tm .assert_produces_warning (FutureWarning , match = "eprecated" ):
318
319
assert cf .get_option ("d.dep" ) == "foo"
319
320
0 commit comments