summaryrefslogtreecommitdiffstats
path: root/test/functional/libgfapi-python-tests.py
diff options
context:
space:
mode:
authorAlpha <alpha@pokesplash.net>2015-08-29 23:47:43 -0400
committerThiago da Silva <thiago@redhat.com>2015-09-16 12:46:34 -0700
commitda1650ef882f7de4158118db71f7a2fdd196bc0a (patch)
tree157897862341e19e931778d650673e39cb58300f /test/functional/libgfapi-python-tests.py
parent5be891e31c15c84f1ce21f2068a6486906289121 (diff)
Provide use_errno to all gfapi foreign function prototypes
Updated tests to include OSError messages Added error reasons to LibgfapiException exceptions BUG 1196161: https://bugzilla.redhat.com/show_bug.cgi?id=1196161 Change-Id: Iddf40751696874ffcaa50cd9d5ecc06c4993baf2 Signed-off-by: Prashanth Pai <ppai@redhat.com>
Diffstat (limited to 'test/functional/libgfapi-python-tests.py')
-rw-r--r--test/functional/libgfapi-python-tests.py24
1 files changed, 21 insertions, 3 deletions
diff --git a/test/functional/libgfapi-python-tests.py b/test/functional/libgfapi-python-tests.py
index 87dbfe0..7eb4cd2 100644
--- a/test/functional/libgfapi-python-tests.py
+++ b/test/functional/libgfapi-python-tests.py
@@ -133,7 +133,13 @@ class FileOpsTest(unittest.TestCase):
# invalid mode
self.assertRaises(ValueError, self.vol.fopen, "file", 'x+')
# file does not exist
- self.assertRaises(OSError, self.vol.fopen, "file", 'r')
+ try:
+ self.vol.fopen("file", "r")
+ except OSError as err:
+ if err.errno != errno.ENOENT:
+ self.fail("Expecting ENOENT")
+ else:
+ self.fail("Expecting ENOENT")
def test_fopen(self):
# Default permission should be 0666
@@ -290,7 +296,13 @@ class FileOpsTest(unittest.TestCase):
def test_rename(self):
newpath = self.path + ".rename"
self.vol.rename(self.path, newpath)
- self.assertRaises(OSError, self.vol.lstat, self.path)
+ try:
+ self.vol.lstat(self.path)
+ except OSError as err:
+ if err.errno != errno.ENOENT:
+ self.fail("Expecting ENOENT")
+ else:
+ self.fail("Expecting ENOENT")
def test_stat(self):
sb = self.vol.stat(self.path)
@@ -299,7 +311,13 @@ class FileOpsTest(unittest.TestCase):
def test_unlink(self):
self.vol.unlink(self.path)
- self.assertRaises(OSError, self.vol.lstat, self.path)
+ try:
+ self.vol.lstat(self.path)
+ except OSError as err:
+ if err.errno != errno.ENOENT:
+ self.fail("Expecting ENOENT")
+ else:
+ self.fail("Expecting ENOENT")
def test_setxattr(self):
value = "hello world"