1414 ('1.0.0' , [('nibabel' , 'neverexisted' )]),
1515 ]
1616
17+ ATTRIBUTE_SCHEDULE = [
18+ ('5.0.0' , [('nibabel.dataobj_images' , 'DataobjImage' , 'get_data' )]),
19+ # Verify that the test will be quiet if the schedule outlives the modules
20+ ('1.0.0' , [('nibabel' , 'Nifti1Image' , 'neverexisted' )]),
21+ ]
22+
1723
1824def test_module_removal ():
1925 for version , to_remove in MODULE_SCHEDULE :
@@ -32,3 +38,19 @@ def test_object_removal():
3238 except ImportError :
3339 continue
3440 assert_false (hasattr (module , obj ), msg = "Time to remove %s.%s" % (module_name , obj ))
41+
42+
43+ def test_attribute_removal ():
44+ for version , to_remove in ATTRIBUTE_SCHEDULE :
45+ if cmp_pkg_version (version ) < 1 :
46+ for module_name , cls , attr in to_remove :
47+ try :
48+ module = __import__ (module_name )
49+ except ImportError :
50+ continue
51+ try :
52+ klass = getattr (module , cls )
53+ except AttributeError :
54+ continue
55+ assert_false (hasattr (klass , attr ),
56+ msg = "Time to remove %s.%s.%s" % (module_name , cls , attr ))
0 commit comments