From b9f7a6534bc41e6c0851c6ddc27256fd711bcc7f Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 22 Oct 2019 12:44:35 +0800 Subject: [PATCH] test/pybind/test_rados: always pass bytes to rados.Object.set_xattr() > an empty '' is of type str, not bytes. python3 says. so let's be more explicit. this change address failures like: ``` ====================================================================== ERROR: test_rados.TestIoctx.test_obj_xattrs ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python3/dist-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/var/ssd/ceph/src/test/pybind/test_rados.py", line 380, in test_obj_xattrs obj.set_xattr(key, value) File "rados.pyx", line 4119, in rados.set_object_locator.retfunc File "rados.pyx", line 4129, in rados.set_object_namespace.retfunc File "rados.pyx", line 4204, in rados.Object.set_xattr File "rados.pyx", line 572, in rados.requires.wrapper.validate_func File "rados.pyx", line 560, in rados.requires.check_type TypeError: xattr_value must be bytes ``` Signed-off-by: Kefu Chai --- src/test/pybind/test_rados.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/pybind/test_rados.py b/src/test/pybind/test_rados.py index 967fc0adae5b4..bd685b3c6172e 100644 --- a/src/test/pybind/test_rados.py +++ b/src/test/pybind/test_rados.py @@ -362,7 +362,7 @@ class TestIoctx(object): ('ns1', 'ns1-c'), ('ns1', 'ns1-d')]) def test_xattrs(self): - xattrs = dict(a=b'1', b=b'2', c=b'3', d=b'a\0b', e=b'\0', f='') + xattrs = dict(a=b'1', b=b'2', c=b'3', d=b'a\0b', e=b'\0', f=b'') self.ioctx.write('abc', b'') for key, value in xattrs.items(): self.ioctx.set_xattr('abc', key, value) @@ -373,7 +373,7 @@ class TestIoctx(object): eq(stored_xattrs, xattrs) def test_obj_xattrs(self): - xattrs = dict(a=b'1', b=b'2', c=b'3', d=b'a\0b', e=b'\0', f='') + xattrs = dict(a=b'1', b=b'2', c=b'3', d=b'a\0b', e=b'\0', f=b'') self.ioctx.write('abc', b'') obj = list(self.ioctx.list_objects())[0] for key, value in xattrs.items(): -- 2.47.3