[PATCH 2/3] Add some tests that verify the results of DeviceTree.populate.
Vratislav Podzimek
vpodzime at redhat.com
Tue May 6 05:56:36 UTC 2014
On Mon, 2014-05-05 at 12:57 -0500, David Lehman wrote:
> ---
> tests/devicetree_test.py | 234 +++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 234 insertions(+)
> create mode 100644 tests/devicetree_test.py
>
> diff --git a/tests/devicetree_test.py b/tests/devicetree_test.py
> new file mode 100644
> index 0000000..a0b7d07
> --- /dev/null
> +++ b/tests/devicetree_test.py
> @@ -0,0 +1,234 @@
> +
> +from imagebackedtestcase import ImageBackedTestCase
> +
> +from blivet.size import Size
> +from blivet import devicelibs
> +from blivet import devicefactory
> +from blivet import util
> +from blivet.udev import udev_trigger
> +
> +"""
> + TODO:
> +
> + - add more lvm tests
> + - thin pool with separate data and metadata volumes?
> + - raid lvs
> + - raid thin pool
> +"""
> +
> +def recursive_getattr(x, attr, default=None):
> + """ Resolve a possibly-dot-containing attribute name. """
> + val = x
> + for sub_attr in attr.split("."):
> + try:
> + val = getattr(val, sub_attr)
> + except AttributeError:
> + return default
> +
> + return val
We already have iutil.getdeepattr(). It doesn't take the 'default'
argument, but we should probably fix that instead of implementing the
same again.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list