summaryrefslogtreecommitdiffstats
path: root/test/unit/gluster/test_gfapi.py
diff options
context:
space:
mode:
authorOleksiy Syvokon <oleksiy.syvokon@gmail.com>2015-08-31 15:36:26 +0300
committerOleksiy Syvokon <oleksiy.syvokon@gmail.com>2015-08-31 15:36:26 +0300
commitca456a770e835f829281dac85bd8c4f00b8624ff (patch)
tree62757f39d8d281218c6b9f206b139cbacc204f2a /test/unit/gluster/test_gfapi.py
parent1ec40d0753e7d5185a7fc810df33370330fc6f90 (diff)
Fix open/fopen in thread other than main
Before this patch, calling Volume.{f}open in a thread other than main thread was causing segmentation fault (test included). The reason is missing ctypes declarations. Also, this patch fixes errno handling for these two functions, making couple of FIXME/TODO notes go away. Change-Id: Iae9638b7d16cc0e0c587fd21a94be677f2d4af59 Signed-off-by: Oleksiy Syvokon <oleksiy.syvokon@gmail.com>
Diffstat (limited to 'test/unit/gluster/test_gfapi.py')
-rw-r--r--test/unit/gluster/test_gfapi.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/unit/gluster/test_gfapi.py b/test/unit/gluster/test_gfapi.py
index 7206aa1..d07ec67 100644
--- a/test/unit/gluster/test_gfapi.py
+++ b/test/unit/gluster/test_gfapi.py
@@ -440,7 +440,7 @@ class TestVolume(unittest.TestCase):
mock_glfs_creat = Mock()
mock_glfs_creat.return_value = 2
- with patch("gluster.api.client.glfs_creat", mock_glfs_creat):
+ with patch("gluster.api.glfs_creat", mock_glfs_creat):
with File(self.vol.open("file.txt", os.O_CREAT, 0644)) as f:
self.assertTrue(isinstance(f, File))
self.assertEqual(mock_glfs_creat.call_count, 1)
@@ -716,7 +716,7 @@ class TestVolume(unittest.TestCase):
mock_glfs_open = Mock()
mock_glfs_open.return_value = 2
- with patch("gluster.api.client.glfs_open", mock_glfs_open):
+ with patch("gluster.api.glfs_open", mock_glfs_open):
with File(self.vol.open("file.txt", os.O_WRONLY)) as f:
self.assertTrue(isinstance(f, File))
self.assertEqual(mock_glfs_open.call_count, 1)
@@ -731,14 +731,14 @@ class TestVolume(unittest.TestCase):
with self.vol.open("file.txt", os.O_WRONLY) as fd:
self.assertEqual(fd, None)
- with patch("gluster.api.client.glfs_open", mock_glfs_open):
+ with patch("gluster.api.glfs_open", mock_glfs_open):
self.assertRaises(OSError, assert_open)
def test_open_direct_success(self):
mock_glfs_open = Mock()
mock_glfs_open.return_value = 2
- with patch("gluster.api.client.glfs_open", mock_glfs_open):
+ with patch("gluster.api.glfs_open", mock_glfs_open):
f = File(self.vol.open("file.txt", os.O_WRONLY))
self.assertTrue(isinstance(f, File))
self.assertEqual(mock_glfs_open.call_count, 1)
@@ -749,7 +749,7 @@ class TestVolume(unittest.TestCase):
mock_glfs_open = Mock()
mock_glfs_open.return_value = None
- with patch("gluster.api.client.glfs_open", mock_glfs_open):
+ with patch("gluster.api.glfs_open", mock_glfs_open):
self.assertRaises(OSError, self.vol.open, "file.txt", os.O_RDONLY)
def test_opendir_success(self):