From 838d67c6350d00f35c3125f1b0d9d1df6bf2a387 Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Wed, 11 Dec 2019 21:51:27 +0100 Subject: [PATCH] Ensure ACL EQ checks not called for non-Linux MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit … via a helper assert function. Not best because context is a bit muddled, but fortunately pytest shows nice call stack. --- tests/test_acls.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/test_acls.py b/tests/test_acls.py index cb186a5..5ef764b 100644 --- a/tests/test_acls.py +++ b/tests/test_acls.py @@ -79,6 +79,11 @@ def ignore_ioerror(errnum, fn, *args, **kwargs): return raise +def assert_acl_eq(a, b): + if HAS_ACL_CHECK: + assert a == b + assert str(a) == str(b) + @pytest.fixture def testdir(): """per-test temp dir based in TEST_DIR""" @@ -319,7 +324,7 @@ class TestLoad: acl2 = ACL(text=TEXT_0755) assert acl1 != acl2 acl1.__init__(acl=acl2) # type: ignore - assert acl1 == acl2 + assert_acl_eq(acl1, acl2) def test_reinit_failure_noop(self): a = posix1e.ACL(text=TEXT_0755) @@ -327,7 +332,7 @@ class TestLoad: assert a == b with pytest.raises(IOError): a.__init__(text='foobar') - assert a == b + assert_acl_eq(a, b) @pytest.mark.xfail(reason="Unreliable test, re-init doesn't always invalidate children") def test_double_init_breaks_children(self): -- 2.39.2