From: Johannes Gijsbers Date: Sun, 12 Dec 2004 15:54:20 +0000 (+0000) Subject: Backport from trunk: use os.geteuid() for checking whether we are root, X-Git-Tag: v2.4.1c1~163 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f6394874a2ceaa74407d1fbbf6f9b047f1736ac;p=thirdparty%2FPython%2Fcpython.git Backport from trunk: use os.geteuid() for checking whether we are root, as suggested by Michael Hudson. --- diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py index 0f78ddc5c0df..3d5533a7f192 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -17,7 +17,7 @@ class TestShutil(unittest.TestCase): self.assertRaises(OSError, shutil.rmtree, filename) if (hasattr(os, 'chmod') and sys.platform[:6] != 'cygwin' - and os.getenv('USER') != 'root'): + and not (hasattr(os, 'geteuid') and os.geteuid() == 0)): def test_on_error(self): self.errorState = 0 os.mkdir(TESTFN)