path: root/test/unit
diff options
authorPrashanth Pai <>2015-06-17 12:46:58 +0530
committerThiago da Silva <>2015-06-18 05:53:54 -0700
commit2c468ae0d5a1e25998373abb72d87b1ee7693816 (patch)
tree3befca1e0e8ae2dfd6fac36e876ca06948724840 /test/unit
parentddbd7b570d0a9f599b417a499c912c5b13a003c9 (diff)
Fix reading of binary data in read()
As per the current code, this is the behavior: >>> with v.fopen("/abc", 'r') as f: ... data = >>> print data <ctypes.c_char_Array_2 object at 0x7fda7d6bbb90> >>> print data.value hello >>> It's incorrect to return a ctypes internal object back to the user. In Python 2.x, read() always returns a string. It's really upto the consumer to decode this string into whatever encoding it was written with. This patch reverts parts of this old change: Ia2bb47343880cbf7121fed9510e4cfa085fe23bd Change-Id: Ia1d3e5834be2b856776bd3cf8382a17ffd61d5df Signed-off-by: Prashanth Pai <>
Diffstat (limited to 'test/unit')
1 files changed, 1 insertions, 1 deletions
diff --git a/test/unit/gluster/ b/test/unit/gluster/
index 1463f76..f850f0f 100644
--- a/test/unit/gluster/
+++ b/test/unit/gluster/
@@ -163,7 +163,7 @@ class TestFile(unittest.TestCase):
with patch("gluster.gfapi.api.glfs_read", _mock_glfs_read):
b =
- self.assertEqual(b.value, "hello")
+ self.assertEqual(b, "hello")
def test_read_fail_exception(self):
mock_glfs_read = Mock()