diff --git a/subiquity/common/filesystem/tests/test_gaps.py b/subiquity/common/filesystem/tests/test_gaps.py index 2b3c0264..04fc5344 100644 --- a/subiquity/common/filesystem/tests/test_gaps.py +++ b/subiquity/common/filesystem/tests/test_gaps.py @@ -22,6 +22,7 @@ from subiquity.models.filesystem import ( MiB, ) from subiquity.models.tests.test_filesystem import ( + make_disk, make_model_and_disk, make_partition, ) @@ -31,26 +32,23 @@ from subiquity.common.filesystem import gaps class TestGaps(unittest.TestCase): def test_basic(self): - model, disk1 = make_model_and_disk() - - pg = gaps.parts_and_gaps(disk1) - self.assertEqual(1, len(pg)) - self.assertTrue(isinstance(pg[0], gaps.Gap)) - self.assertEqual(MiB, pg[0].offset) + [gap] = gaps.parts_and_gaps(make_disk()) + self.assertTrue(isinstance(gap, gaps.Gap)) + self.assertEqual(MiB, gap.offset) class TestDiskGaps(unittest.TestCase): def test_no_partition_gpt(self): size = 1 << 30 - m, d = make_model_and_disk(size=size, ptable='gpt') + d = make_disk(size=size, ptable='gpt') self.assertEqual( gaps.find_disk_gaps_v2(d), [gaps.Gap(d, MiB, size - 2*MiB, False)]) def test_no_partition_dos(self): size = 1 << 30 - m, d = make_model_and_disk(size=size, ptable='dos') + d = make_disk(size=size, ptable='dos') self.assertEqual( gaps.find_disk_gaps_v2(d), [gaps.Gap(d, MiB, size - MiB, False)]) diff --git a/subiquity/models/tests/test_filesystem.py b/subiquity/models/tests/test_filesystem.py index e495f985..1d29576e 100644 --- a/subiquity/models/tests/test_filesystem.py +++ b/subiquity/models/tests/test_filesystem.py @@ -143,7 +143,9 @@ def make_model(bootloader=None): return model -def make_disk(fs_model, **kw): +def make_disk(fs_model=None, **kw): + if fs_model is None: + fs_model = make_model() if 'serial' not in kw: kw['serial'] = 'serial%s' % len(fs_model._actions) if 'path' not in kw: