From 184ff0f507db9c73f708be14607a8f2a7ad5c128 Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Tue, 20 Apr 2021 15:32:54 -0400 Subject: [PATCH] Skip test_unwriteable when tests are run as root Writes by root ignore fs permissions, so this test will fail when run as root. --- tests/ansible/tests/target_test.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/ansible/tests/target_test.py b/tests/ansible/tests/target_test.py index 6bdc949b..27c375da 100644 --- a/tests/ansible/tests/target_test.py +++ b/tests/ansible/tests/target_test.py @@ -86,6 +86,8 @@ class IsGoodTempDirTest(unittest2.TestCase): self.assertFalse(self.func(bleh)) self.assertEquals(open(bleh).read(), 'derp') + @unittest2.skipIf( + os.geteuid() == 0, 'writes by root ignore directory permissions') def test_unwriteable(self): with NamedTemporaryDirectory() as temp_path: os.chmod(temp_path, 0)