Saggi Mizrahi has uploaded a new change for review.
Change subject: Skip mountTests:MountTests.testLoopMount test if mkfs.ext2 is not
installed
......................................................................
Skip mountTests:MountTests.testLoopMount test if mkfs.ext2 is not installed
Change-Id: I7fef7122157dd69f725d793332956a81845dd991
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M tests/mountTests.py
1 file changed, 22 insertions(+), 13 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/93/9593/1
diff --git a/tests/mountTests.py b/tests/mountTests.py
index d9b64f2..6a914e0 100644
--- a/tests/mountTests.py
+++ b/tests/mountTests.py
@@ -19,14 +19,17 @@
#
from contextlib import contextmanager
-from storage.misc import execCmd
-import storage.mount as mount
-from testValidation import checkSudo
-
-from testrunner import VdsmTestCase as TestCaseBase
+import errno
from tempfile import mkstemp, mkdtemp
import os
import shutil
+
+from nose.plugins.skip import SkipTest
+
+from testrunner import VdsmTestCase as TestCaseBase
+from storage.misc import execCmd
+import storage.mount as mount
+from testValidation import checkSudo
FLOPPY_SIZE = (2 ** 20) * 4
@@ -52,11 +55,17 @@
checkSudo(["mount", "-o", "loop",
"somefile", "target"])
checkSudo(["umount", "target"])
mpath = mkdtemp()
- with createFloppyImage(FLOPPY_SIZE) as path:
- m = mount.Mount(path, mpath)
- m.mount(mntOpts="loop")
- try:
- self.assertTrue(m.isMounted())
- finally:
- m.umount()
- shutil.rmtree(mpath)
+ try:
+ with createFloppyImage(FLOPPY_SIZE) as path:
+ m = mount.Mount(path, mpath)
+ m.mount(mntOpts="loop")
+ try:
+ self.assertTrue(m.isMounted())
+ finally:
+ m.umount()
+ shutil.rmtree(mpath)
+ except OSError as e:
+ if e.errno == errno.ENOENT:
+ raise SkipTest("cannot execute mkfs.ext2")
+
+ raise
--
To view, visit
http://gerrit.ovirt.org/9593
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7fef7122157dd69f725d793332956a81845dd991
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>