diff options
author | Christian Heimes <christian@python.org> | 2022-06-27 18:27:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-27 18:27:19 (GMT) |
commit | 7e0d98ecb3f049841de9854e7a3eca3e2638e4b2 (patch) | |
tree | dbc35d553d10f812f9f4dd479c76715824a6799a /Lib/test/test_argparse.py | |
parent | 117217245390ed3e6fe166180f052e022d296921 (diff) | |
download | cpython-7e0d98ecb3f049841de9854e7a3eca3e2638e4b2.zip cpython-7e0d98ecb3f049841de9854e7a3eca3e2638e4b2.tar.gz cpython-7e0d98ecb3f049841de9854e7a3eca3e2638e4b2.tar.bz2 |
gh-94315: Check for DAC override capability (GH-94316)
``os.geteuid() == 0`` is not a reliable check whether the current user
has the capability to bypass permission checks. Tests now probe for DAC
override.
Diffstat (limited to 'Lib/test/test_argparse.py')
-rw-r--r-- | Lib/test/test_argparse.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py index 673ef89..425b6bb 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -1734,8 +1734,7 @@ class WFile(object): return self.name == other.name -@unittest.skipIf(hasattr(os, 'geteuid') and os.geteuid() == 0, - "non-root user required") +@os_helper.skip_if_dac_override class TestFileTypeW(TempDirMixin, ParserTestCase): """Test the FileType option/argument type for writing files""" @@ -1757,8 +1756,8 @@ class TestFileTypeW(TempDirMixin, ParserTestCase): ('-x - -', NS(x=eq_stdout, spam=eq_stdout)), ] -@unittest.skipIf(hasattr(os, 'geteuid') and os.geteuid() == 0, - "non-root user required") + +@os_helper.skip_if_dac_override class TestFileTypeX(TempDirMixin, ParserTestCase): """Test the FileType option/argument type for writing new files only""" @@ -1778,8 +1777,7 @@ class TestFileTypeX(TempDirMixin, ParserTestCase): ] -@unittest.skipIf(hasattr(os, 'geteuid') and os.geteuid() == 0, - "non-root user required") +@os_helper.skip_if_dac_override class TestFileTypeWB(TempDirMixin, ParserTestCase): """Test the FileType option/argument type for writing binary files""" @@ -1796,8 +1794,7 @@ class TestFileTypeWB(TempDirMixin, ParserTestCase): ] -@unittest.skipIf(hasattr(os, 'geteuid') and os.geteuid() == 0, - "non-root user required") +@os_helper.skip_if_dac_override class TestFileTypeXB(TestFileTypeX): "Test the FileType option/argument type for writing new binary files only" |