1414
1515
1616@required_plugins (("part" ,))
17- class PartTestCase (unittest .TestCase ):
17+ class PartTest (unittest .TestCase ):
1818
1919 requested_plugins = BlockDev .plugin_specs_from_names (("part" ,))
20- block_size = 512
21- _sparse_size = 100 * 1024 ** 2
22- _num_devices = 1
23- loop_devs = []
24- dev_files = []
2520
2621 @classmethod
2722 def _get_fdisk_version (cls ):
@@ -38,6 +33,14 @@ def setUpClass(cls):
3833 else :
3934 BlockDev .reinit (cls .requested_plugins , True , None )
4035
36+
37+ class PartTestCase (PartTest ):
38+ block_size = 512
39+ _sparse_size = 100 * 1024 ** 2
40+ _num_devices = 1
41+ loop_devs = []
42+ dev_files = []
43+
4144 def setUp (self ):
4245 self .addCleanup (self ._clean_up )
4346
@@ -64,11 +67,20 @@ def _clean_up(self):
6467 self .loop_devs .clear ()
6568
6669
67- class PartCPluginVersionCase ( PartTestCase ):
70+ class PartNoDevTestCase ( PartTest ):
6871 @tag_test (TestTags .NOSTORAGE )
6972 def test_plugin_version (self ):
7073 self .assertEqual (BlockDev .get_plugin_soname (BlockDev .Plugin .PART ), "libbd_part.so.3" )
7174
75+ @tag_test (TestTags .NOSTORAGE )
76+ def test_part_type_str (self ):
77+ types = {BlockDev .PartType .NORMAL : 'primary' , BlockDev .PartType .LOGICAL : 'logical' ,
78+ BlockDev .PartType .EXTENDED : 'extended' , BlockDev .PartType .FREESPACE : 'free' ,
79+ BlockDev .PartType .METADATA : 'metadata' , BlockDev .PartType .PROTECTED : 'primary' }
80+
81+ for key , value in types .items ():
82+ self .assertEqual (BlockDev .part_get_type_str (key ), value )
83+
7284
7385class PartCreateTableCase (PartTestCase ):
7486 _num_devices = 2
@@ -1353,18 +1365,3 @@ def test_set_part_attributes(self):
13531365 self .assertTrue (succ )
13541366 ps = BlockDev .part_get_part_spec (self .loop_devs [0 ], ps .path )
13551367 self .assertEqual (ps .attrs , attrs )
1356-
1357-
1358- class PartNoDevCase (PartTestCase ):
1359-
1360- def setUp (self ):
1361- # no devices needed for this test case
1362- pass
1363-
1364- def test_part_type_str (self ):
1365- types = {BlockDev .PartType .NORMAL : 'primary' , BlockDev .PartType .LOGICAL : 'logical' ,
1366- BlockDev .PartType .EXTENDED : 'extended' , BlockDev .PartType .FREESPACE : 'free' ,
1367- BlockDev .PartType .METADATA : 'metadata' , BlockDev .PartType .PROTECTED : 'primary' }
1368-
1369- for key , value in types .items ():
1370- self .assertEqual (BlockDev .part_get_type_str (key ), value )
0 commit comments