tests package

Submodules

tests.action_test module

class tests.action_test.DeviceActionTestCase(methodName='runTest')

Bases: tests.storagetestcase.StorageTestCase

DeviceActionTestSuite

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()

Create something like a preexisting autopart on two disks (sda,sdb).

The other two disks (sdc,sdd) are left for individual tests to use.

test_action_apply_cancel()
test_action_creation()

Verify correct operation of action class constructors.

test_action_dependencies()

Verify correct functioning of action dependencies.

test_action_obsoletes()

Verify correct operation of DeviceAction.obsoletes.

test_action_pruning()

Verify correct functioning of action pruning.

test_action_registration()

Verify correct operation of action registration and cancelling.

test_action_sorting(*args, **kwargs)

Verify correct functioning of action sorting.

test_actions()

Verify correct management of actions.

  • action creation/registration/cancellation
    • ActionCreateDevice adds device to tree
    • ActionDestroyDevice removes device from tree
    • ActionCreateFormat sets device.format in tree
    • ActionDestroyFormat unsets device.format in tree
    • cancelled action’s registration side-effects reversed
    • failure to register destruction of non-leaf device
    • failure to register creation of device already in tree?
    • failure to register destruction of device not in tree?
  • action pruning
    • non-existent-device create..destroy cycles removed
      • all actions on this device should get removed
    • all actions pruned from to-be-destroyed devices
      • resize, format, &c
    • redundant resize/format actions pruned
      • last one registered stays
  • action sorting
    • destroy..resize..create
    • creation
      • leaves-last, including formatting
    • destruction
      • leaves-first
test_container_actions()
test_lv_from_lvs_actions()

tests.blivet_test module

tests.clearpart_test module

class tests.clearpart_test.ClearPartTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()
test_initialize_disk()

magic partitions non-empty partition table

test_recursive_remove()

protected device at various points in stack

test_should_clear()

Test the Blivet.should_clear method.

test_should_clear_tags()

Test the Blivet.should_clear method using tags.

tests.dbus_test module

tests.devicefactory_test module

class tests.devicefactory_test.DeviceFactoryTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

device_class = None

device class to expect from devicefactory

device_type = None

device type constant to pass to devicefactory.get_device_factory

encryption_supported = True

whether encryption of this device type is supported by blivet

setUp()
test_default_factory_type()
test_device_factory()
test_get_free_disk_space()
test_normalize_size()
class tests.devicefactory_test.LVMFactoryTestCase(methodName='runTest')

Bases: tests.devicefactory_test.DeviceFactoryTestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

device_class

alias of LVMLogicalVolumeDevice

device_type = 0
test_device_factory()
test_get_container()
class tests.devicefactory_test.LVMThinPFactoryTestCase(methodName='runTest')

Bases: tests.devicefactory_test.LVMFactoryTestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

device_class

alias of LVMLogicalVolumeDevice

device_type = 5
encryption_supported = False
class tests.devicefactory_test.MDFactoryTestCase(methodName='runTest')

Bases: tests.devicefactory_test.DeviceFactoryTestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

device_class

alias of MDRaidArrayDevice

device_type = 1
test_device_factory()
test_mdfactory()
class tests.devicefactory_test.PartitionFactoryTestCase(methodName='runTest')

Bases: tests.devicefactory_test.DeviceFactoryTestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

device_class

alias of PartitionDevice

device_type = 2
test_bug1178884()

tests.devicetree_test module

tests.events_test module

tests.imagebackedtestcase module

class tests.imagebackedtestcase.ImageBackedTestCase(methodName='runTest')

Bases: unittest.case.TestCase

A class to encapsulate testing of blivet using block devices.

The basic idea is you create some scratch block devices and then run some test code on them.

disks defines the set of disk images.

_set_up_storage() is where you specify the initial layout of the disks. It will be written to the disk images in set_up_storage().

You then write test methods as usual that use the disk images, which will be cleaned up and removed when each test method finishes.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

disks = {'disk1': Size (2 GiB), 'disk2': Size (2 GiB)}

The names and sizes of the disk images to create/use.

initialize_disks = True

Whether or not to create a disklabel on the disks.

setUp()

Do any setup required prior to running a test.

set_up_disks()

Create disk image files to build the test’s storage on.

If you are actually creating the disk image files here don’t forget to set the initialize_disks flag so they get a fresh disklabel when clear_partitions gets called from create_storage later.

set_up_storage()

Create a device stack on top of disk images for this test to run on.

This will write the configuration to whatever disk images are defined in set_up_disks.

tests.lib module

tests.lib.assertVerboseEqual(left, right, msg=None)
tests.lib.assertVerboseListEqual(left, right, msg=None)

tests.loopbackedtestcase module

class tests.loopbackedtestcase.LoopBackedTestCase(methodName='run_test', device_spec=None, block_size=None)

Bases: unittest.case.TestCase

LoopBackedTestCase manages loop devices.

It constructs loop devices according to loop_device_spec, sets them up, and tears them down again.

Parameters:
  • device_spec (list of Size or NoneType) – list containing the size of each loop device
  • block_size (Size or NoneType) – block size for dd command when making devices
DEFAULT_BLOCK_SIZE = Size (1024 B)
DEFAULT_STORE_SIZE = Size (100 MiB)
setUp()
tests.loopbackedtestcase.get_free_loop_dev()

Get the name of the free loop device that losetup reports.

Returns:the name of the free loop device
Return type:str
Raises:OSError – on failure
tests.loopbackedtestcase.make_loop_dev(device_name, file_name)

Set up a loop device with a backing store.

Parameters:
  • device_name (str) – the path of the loop device
  • file_name (str) – the path of the backing file
tests.loopbackedtestcase.make_store(file_name, num_blocks=102400, block_size=1024)

Set up the backing store for a loop device.

Parameters:
  • file_name (str) – the path of the backing file
  • num_blocks (int) – the size of file_name in number of blocks
  • block_size (int) – the number of bytes in a block
tests.loopbackedtestcase.remove_loop_dev(device_name)

tests.parentlist_test module

class tests.parentlist_test.ParentListTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_device_parents()

Verify that Device.parents functions as expected.

test_parent_list()

tests.partitioning_test module

tests.platform_test module

class tests.platform_test.PlatformTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_default_disklabel_type()
test_get_best_disklabel_type()
test_partition_weight()
class tests.platform_test.Weighted(fstype, mountpoint, cls, weight)

Bases: tuple

Create new instance of Weighted(fstype, mountpoint, cls, weight)

cls

Alias for field number 2

fstype

Alias for field number 0

mountpoint

Alias for field number 1

weight

Alias for field number 3

tests.populator_test module

tests.size_test module

class tests.size_test.SizeTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_convert_to_precision()
test_convert_to_with_size()
test_exceptions()
test_floating_point_str()
test_human_readable()
test_human_readable_fractional_quantities()
test_leading_zero()
test_no_units_in_string()
test_partial_bytes()
test_pickling()
test_scientific_notation()
test_segative()
test_white_space()
class tests.size_test.TranslationTestCase(methodName='runTest')

Bases: unittest.case.TestCase

setUp()
test_human_readable_translation()
test_round_to_nearest()
test_translated()
class tests.size_test.UtilityMethodsTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_arithmetic()

tests.storagetestcase module

class tests.storagetestcase.StorageTestCase(methodName='runTest')

Bases: unittest.case.TestCase

This is a base class for storage test cases. It sets up imports of the blivet package, along with an Anaconda instance and a Storage instance. There are lots of little patches to prevent various pieces of code from trying to access filesystems and/or devices on the host system, along with a couple of convenience methods.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

destroy_all_devices(disks=None)

Remove all devices from the devicetree.

Keyword Arguments:

disks - a list of names of disks to remove partitions from

Note: this is largely ripped off from partitioning.clear_partitions.

new_device(*args, **kwargs)

Return a new Device instance suitable for testing.

new_format(*args, **kwargs)

Return a new DeviceFormat instance suitable for testing.

Keyword Arguments:

device_instance - StorageDevice instance this format will be
created on. This is needed for setup of resizable formats.

All other arguments are passed directly to blivet.formats.get_format.

schedule_create_device(device)

Schedule an action to create the specified device.

Verify that the device is not already in the tree and that the act of scheduling/registering the action also adds the device to the tree.

Return the DeviceAction instance.

schedule_create_format(device, fmt)

Schedule an action to write a new format to a device.

Verify that the device is already in the tree, that it is not already set up to contain the specified format, and that the act of registering/scheduling the action causes the new format to be reflected in the tree.

Return the DeviceAction instance.

schedule_destroy_device(device)

Schedule an action to destroy the specified device.

Verify that the device exists initially and that the act of scheduling/registering the action also removes the device from the tree.

Return the DeviceAction instance.

schedule_destroy_format(device)

Schedule an action to remove a format from a device.

Verify that the device is already in the tree and that the act of registering/scheduling the action causes the new format to be reflected in the tree.

Return the DeviceAction instance.

setUp()

tests.test_compat module

tests.test_compat.add_move(mod)
tests.test_compat.setup()

tests.tsort_test module

class tests.tsort_test.TopologicalSortTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

run_test()

tests.udev_test module

class tests.udev_test.UdevTest(methodName='runTest')

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()
tearDown()
test_udev_get_device()
udev_settle_test()
udev_trigger_test()

tests.unsupported_disklabel_test module

tests.util_test module

Module contents