Switch namespace_none test to check all calls
authorIustin Pop <iustin@k1024.org>
Tue, 26 Nov 2019 02:24:42 +0000 (03:24 +0100)
committerIustin Pop <iustin@k1024.org>
Tue, 26 Nov 2019 02:24:42 +0000 (03:24 +0100)
Instead of all input parameter types for one call. This is better
since more calls are checked, and the parameter type checking is not
the goal of this test.

test/test_xattr.py

index 2a8a6340e2b1bc5570ee935643962ca0c971eb21..0a5fbdf047fc40cf032d5e64d1bcc9598d9e4aa7 100644 (file)
@@ -386,9 +386,21 @@ def test_symlinks_user_fail(testdir, use_dangling):
     with pytest.raises(IOError):
         xattr.setxattr(sname, USER_ATTR, USER_VAL, XATTR_CREATE, True)
 
-def test_none_namespace(subject):
+@pytest.mark.parametrize(
+    "call, args", [(xattr.get, [USER_ATTR]),
+                   (xattr.list, []),
+                   (xattr.remove, [USER_ATTR]),
+                   (xattr.get, [USER_ATTR]),
+                   (xattr.set, [USER_ATTR, USER_VAL])])
+def test_none_namespace(testdir, call, args):
+    # Don't want to use subject, since that would prevent xfail test
+    # on path objects (due to hiding the exception here).
+    f = get_file_name(testdir)
+    with pytest.raises(TypeError):
+        call(f, *args, namespace=None)
+    fd = get_file_fd(testdir)
     with pytest.raises(TypeError):
-        xattr.get(subject[0], USER_ATTR, namespace=None)
+        call(fd, *args, namespace=None)
 
 @pytest.mark.parametrize(
     "call",