[Python-checkins] cpython (2.7): Issue #13308: Fix test_httpservers failures when run as root.
charles-francois.natali
python-checkins at python.org
Wed Nov 2 19:36:36 CET 2011
http://hg.python.org/cpython/rev/d1cde7081bf5
changeset: 73306:d1cde7081bf5
branch: 2.7
user: Charles-François Natali <neologix at free.fr>
date: Wed Nov 02 19:32:54 2011 +0100
summary:
Issue #13308: Fix test_httpservers failures when run as root.
files:
Lib/test/test_httpservers.py | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py
--- a/Lib/test/test_httpservers.py
+++ b/Lib/test/test_httpservers.py
@@ -324,8 +324,10 @@
f = open(os.path.join(self.tempdir_name, 'index.html'), 'w')
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)
@@ -370,6 +372,9 @@
form.getfirst("bacon"))
"""
+
+ at 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
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list