Skip to content

Commit 2296899

Browse files
jnsnowkevmw
authored andcommitted
iotests/migrate-bitmaps-test: delint
Mostly uninteresting stuff. Move the test injections under a function named main() so that the variables used during that process aren't in the global scope. Signed-off-by: John Snow <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Hanna Reitz <[email protected]> Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]> Reviewed-by: Kevin Wolf <[email protected]> Message-Id: <[email protected]> Signed-off-by: Kevin Wolf <[email protected]>
1 parent ac74246 commit 2296899

File tree

1 file changed

+28
-22
lines changed

1 file changed

+28
-22
lines changed

tests/qemu-iotests/tests/migrate-bitmaps-test

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2020
#
2121

22-
import os
2322
import itertools
2423
import operator
24+
import os
2525
import re
26+
2627
import iotests
2728
from iotests import qemu_img, qemu_img_create, Timeout
2829

@@ -224,25 +225,6 @@ def inject_test_case(klass, suffix, method, *args, **kwargs):
224225
setattr(klass, 'test_' + method + suffix, lambda self: mc(self))
225226

226227

227-
for cmb in list(itertools.product((True, False), repeat=5)):
228-
name = ('_' if cmb[0] else '_not_') + 'persistent_'
229-
name += ('_' if cmb[1] else '_not_') + 'migbitmap_'
230-
name += '_online' if cmb[2] else '_offline'
231-
name += '_shared' if cmb[3] else '_nonshared'
232-
if cmb[4]:
233-
name += '__pre_shutdown'
234-
235-
inject_test_case(TestDirtyBitmapMigration, name, 'do_test_migration',
236-
*list(cmb))
237-
238-
for cmb in list(itertools.product((True, False), repeat=2)):
239-
name = ('_' if cmb[0] else '_not_') + 'persistent_'
240-
name += ('_' if cmb[1] else '_not_') + 'migbitmap'
241-
242-
inject_test_case(TestDirtyBitmapMigration, name,
243-
'do_test_migration_resume_source', *list(cmb))
244-
245-
246228
class TestDirtyBitmapBackingMigration(iotests.QMPTestCase):
247229
def setUp(self):
248230
qemu_img_create('-f', iotests.imgfmt, base_a, size)
@@ -304,6 +286,30 @@ class TestDirtyBitmapBackingMigration(iotests.QMPTestCase):
304286
self.assert_qmp(result, 'return', {})
305287

306288

289+
def main() -> None:
290+
for cmb in list(itertools.product((True, False), repeat=5)):
291+
name = ('_' if cmb[0] else '_not_') + 'persistent_'
292+
name += ('_' if cmb[1] else '_not_') + 'migbitmap_'
293+
name += '_online' if cmb[2] else '_offline'
294+
name += '_shared' if cmb[3] else '_nonshared'
295+
if cmb[4]:
296+
name += '__pre_shutdown'
297+
298+
inject_test_case(TestDirtyBitmapMigration, name, 'do_test_migration',
299+
*list(cmb))
300+
301+
for cmb in list(itertools.product((True, False), repeat=2)):
302+
name = ('_' if cmb[0] else '_not_') + 'persistent_'
303+
name += ('_' if cmb[1] else '_not_') + 'migbitmap'
304+
305+
inject_test_case(TestDirtyBitmapMigration, name,
306+
'do_test_migration_resume_source', *list(cmb))
307+
308+
iotests.main(
309+
supported_fmts=['qcow2'],
310+
supported_protocols=['file']
311+
)
312+
313+
307314
if __name__ == '__main__':
308-
iotests.main(supported_fmts=['qcow2'],
309-
supported_protocols=['file'])
315+
main()

0 commit comments

Comments
 (0)