[PATCH 2/3] Add some tests that verify the results of DeviceTree.populate.

David Lehman dlehman at redhat.com
Tue May 6 16:21:39 UTC 2014



On 05/06/2014 12:56 AM, Vratislav Podzimek wrote:
> 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.

That's in anaconda. I've made a fairly concerted effort to keep blivet 
from requiring anaconda thus far. Are you suggesting we copy the 
function from pyanaconda.iutil into blivet.util, add a requires for 
anaconda, or something else?

David


More information about the anaconda-patches mailing list