[PATCH blivet/master 2/4] lvm_test: refactoring + minor fix
Anne Mulhern
amulhern at redhat.com
Wed Sep 24 13:03:39 UTC 2014
----- Original Message -----
> From: "Will Woods" <wwoods at redhat.com>
> To: anaconda-patches at lists.fedorahosted.org
> Sent: Tuesday, September 23, 2014 6:14:01 PM
> Subject: [PATCH blivet/master 2/4] lvm_test: refactoring + minor fix
>
> Factor out a LVMAsRootTestCaseBase so we can more easily add new
> functional test cases.
>
> Also fix a buglet in tearDown where a failed pvremove() could make us
> exit the loop without finishing.
> ---
> tests/devicelibs_test/lvm_test.py | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/tests/devicelibs_test/lvm_test.py
> b/tests/devicelibs_test/lvm_test.py
> index b7000ea..762ac1b 100755
> --- a/tests/devicelibs_test/lvm_test.py
> +++ b/tests/devicelibs_test/lvm_test.py
> @@ -30,11 +30,11 @@ class LVMTestCase(unittest.TestCase):
> # call if the device is non-existant, and usually that exception is caught
> and
> # an LVMError is then raised, but not always.
>
> -class LVMAsRootTestCase(loopbackedtestcase.LoopBackedTestCase):
> +class LVMAsRootTestCaseBase(loopbackedtestcase.LoopBackedTestCase):
>
> def __init__(self, methodName='runTest'):
> """Set up the structure of the volume group."""
> - super(LVMAsRootTestCase, self).__init__(methodName=methodName)
> + super(LVMAsRootTestCaseBase, self).__init__(methodName=methodName)
> self._vg_name = "test-vg"
> self._lv_name = "test-lv"
>
> @@ -57,14 +57,17 @@ class
> LVMAsRootTestCase(loopbackedtestcase.LoopBackedTestCase):
> except LVMError:
> pass
>
> - try:
> - for dev in self.loopDevices:
> + for dev in self.loopDevices:
> + try:
> lvm.pvremove(dev)
> - except LVMError:
> - pass
> + except LVMError:
> + pass
>
> - super(LVMAsRootTestCase, self).tearDown()
> + super(LVMAsRootTestCaseBase, self).tearDown()
>
> +
> +
> +class LVMAsRootTestCase(LVMAsRootTestCaseBase):
> def testLVM(self):
> _LOOP_DEV0 = self.loopDevices[0]
> _LOOP_DEV1 = self.loopDevices[1]
> @@ -226,6 +229,8 @@ class
> LVMAsRootTestCase(loopbackedtestcase.LoopBackedTestCase):
> # fail
> self.assertEqual(lvm.lvs(vg_name="wrong-vg-name"), {})
>
> + # TODO: lvorigin, lvsnapshot*, thin*
> +
Not in this 200 line method.
The top of the file, maybe?
> ##
> ## has_lvm
> ##
> --
> 1.9.3
>
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
>
Otherwise OK.
- mulhern
More information about the anaconda-patches
mailing list