tests.py: Check xattr module version. Fix to work with version xattr 0.9.1
authorFelipe Barriga Richards <spam@felipebarriga.cl>
Mon, 27 Feb 2017 03:15:03 +0000 (00:15 -0300)
committerFelipe Barriga Richards <spam@felipebarriga.cl>
Mon, 27 Feb 2017 03:15:03 +0000 (00:15 -0300)
test/tests.py

index 51e7b1e6a7295160ee05dc4945178ac4202697a0..38452e5c5a65d947d95e0445d3e1caeab0635aec 100755 (executable)
@@ -14,6 +14,9 @@ import xattr
 from pathlib import Path
 import os
 
+if xattr.__version__ != '0.9.1':
+    print("WARNING, only tested with xattr version 0.9.1")
+
 # TODO
 # - listxattr: list too long
 # - sidecar file permissions
@@ -161,9 +164,9 @@ class TestXAttrs(unittest.TestCase):
 
     def test_xattr_list(self):
         enc = "utf-8"
-        key1 = b"user.foo"
-        key2 = b"user.foo2"
-        key3 = b"user.foo3"
+        key1 = "user.foo"
+        key2 = "user.foo2"
+        key3 = "user.foo3"
         value = "bar"
 
         # set 3 keys
@@ -190,7 +193,7 @@ class TestXAttrs(unittest.TestCase):
         # list
         attrs = xattr.listxattr(self.randomFile)
         self.assertEqual(len(attrs), 1)
-        self.assertTrue(key.encode() in attrs)
+        self.assertEqual(attrs[0], key)
 
         # read
         read_value = xattr.getxattr(self.randomFile, key)