From 895d47860aaef86981167fdb7d889c57c3142b04 Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Mon, 25 Nov 2019 04:43:48 +0100 Subject: [PATCH] Split the monolithic ListSetGetDeprecated test The failure modes are better tested separately, and leave this main test as set-get-remove simple test. --- test/test_xattr.py | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/test/test_xattr.py b/test/test_xattr.py index e6a6ecb..df6fbed 100644 --- a/test/test_xattr.py +++ b/test/test_xattr.py @@ -236,23 +236,38 @@ def test_ListSetGet(subject, use_ns): else: xattr.remove(item, USER_ATTR) -def test_ListSetGetDeprecated(subject): - """check deprecated list, set, get operations against an item""" + +def test_replace_on_missing_deprecated(subject): item = subject[0] lists_equal(xattr.listxattr(item), []) with pytest.raises(EnvironmentError): xattr.setxattr(item, USER_ATTR, USER_VAL, XATTR_REPLACE) + +def test_create_on_existing_deprecated(subject): + item = subject[0] + lists_equal(xattr.listxattr(item), []) xattr.setxattr(item, USER_ATTR, USER_VAL, 0) with pytest.raises(EnvironmentError): xattr.setxattr(item, USER_ATTR, USER_VAL, XATTR_CREATE) + +def test_remove_on_missing_deprecated(subject): + """check deprecated list, set, get operations against an item""" + item = subject[0] + lists_equal(xattr.listxattr(item), []) + with pytest.raises(EnvironmentError): + xattr.removexattr(item, USER_ATTR) + +def test_set_get_remove_deprecated(subject): + """check deprecated list, set, get operations against an item""" + item = subject[0] + lists_equal(xattr.listxattr(item), []) + xattr.setxattr(item, USER_ATTR, USER_VAL, 0) lists_equal(xattr.listxattr(item), [USER_ATTR]) assert xattr.getxattr(item, USER_ATTR) == USER_VAL tuples_equal(xattr.get_all(item), [(USER_ATTR, USER_VAL)]) xattr.removexattr(item, USER_ATTR) lists_equal(xattr.listxattr(item), []) tuples_equal(xattr.get_all(item), []) - with pytest.raises(EnvironmentError): - xattr.removexattr(item, USER_ATTR) def test_many_ops(subject): """test many ops""" -- 2.39.5