diff options
author | Charles-François Natali <neologix@free.fr> | 2011-11-02 18:36:02 (GMT) |
---|---|---|
committer | Charles-François Natali <neologix@free.fr> | 2011-11-02 18:36:02 (GMT) |
commit | b2cca00c142d69510a268bba9cfeb6eefec923e4 (patch) | |
tree | 03547bf409caf26e99bee95d668df57295ab5cb3 /Lib/test/test_httpservers.py | |
parent | 23e1ecbd66e23711d660894402178bac863bad43 (diff) | |
parent | f7ed9fc063cc4c11cfdf36b6c5023b984ed36b26 (diff) | |
download | cpython-b2cca00c142d69510a268bba9cfeb6eefec923e4.zip cpython-b2cca00c142d69510a268bba9cfeb6eefec923e4.tar.gz cpython-b2cca00c142d69510a268bba9cfeb6eefec923e4.tar.bz2 |
Issue #13308: Fix test_httpservers failures when run as root.
Diffstat (limited to 'Lib/test/test_httpservers.py')
-rw-r--r-- | Lib/test/test_httpservers.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py index 1bbaf0e..cc15dd6 100644 --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -259,8 +259,9 @@ class SimpleHTTPServerTestCase(BaseTestCase): with open(os.path.join(self.tempdir_name, 'index.html'), 'w') as f: response = self.request('/' + self.tempdir_name + '/') self.check_status_and_reason(response, 200) - if os.name == 'posix': - # chmod won't work as expected on Windows platforms + # chmod() doesn't work as expected on Windows, and filesystem + # permissions are ignored by root on Unix. + if os.name == 'posix' and os.geteuid() != 0: os.chmod(self.tempdir, 0) response = self.request(self.tempdir_name + '/') self.check_status_and_reason(response, 404) @@ -305,6 +306,9 @@ print("%%s, %%s, %%s" %% (form.getfirst("spam"), form.getfirst("eggs"), form.getfirst("bacon"))) """ + +@unittest.skipIf(hasattr(os, 'geteuid') and os.geteuid() == 0, + "This test can't be run reliably as root (issue #13308).") class CGIHTTPServerTestCase(BaseTestCase): class request_handler(NoLogRequestHandler, CGIHTTPRequestHandler): pass |