Issue 17746: test_shutil.TestWhich.test_non_matching_mode fails when running as root (original) (raw)

Issue17746

Created on 2013-04-16 08:13 by jibel, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_shutil.log jibel,2013-04-16 08:13
test_shutil_skip_test_non_matching_mode.patch serhiy.storchaka,2013-05-26 06:55 review
Messages (5)
msg187054 - (view) Author: Jean-Baptiste Lallement (jibel) Date: 2013-04-16 08:13
The test test_shutil.TestWhich.test_non_matching_mode fails when running as root because the temporary file is always writeable for this user. To reproduce on linux: $ sudo python3.3 -E -Wd -tt /usr/lib/python3.3/test/regrtest.py -v -w test_shutil [...] ====================================================================== FAIL: test_non_matching_mode (test.test_shutil.TestWhich) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python3.3/test/test_shutil.py", line 1334, in test_non_matching_mode self.assertIsNone(rv) AssertionError: '/tmp/Tmpnf1xg5/Tmptzup_q.Exe' is not None ---------------------------------------------------------------------- Possible solutions: - skip the test when running as root - search for a file with executable bit set instead of writeable - set immutable attribute on the file
msg187055 - (view) Author: Jean-Baptiste Lallement (jibel) Date: 2013-04-16 08:14
Reference on LP: https://bugs.launchpad.net/ubuntu/+source/python3.3/+bug/1169458
msg187064 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2013-04-16 10:23
one way would be to skip this test when running as root. Would the check for the X bit work on Windows? @unittest.skipUnless(hasattr(os, 'getuid') and os.getuid() != 0, "test always succeeds as root")
msg190067 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-05-26 06:55
Here is a patch which skips test_non_matching_mode when run as root (for early skip in discovery stage and for more appropriate for this case report) and when run on OS or FS which doesn't support read-only files (should cover all other cases).
msg190203 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-05-28 12:56
New changeset b98380a1d979 by Serhiy Storchaka in branch '3.3': Issue #17746: Skip test_shutil.test_non_matching_mode when run as root or http://hg.python.org/cpython/rev/b98380a1d979 New changeset 96e543ba96a4 by Serhiy Storchaka in branch 'default': Issue #17746: Skip test_shutil.test_non_matching_mode when run as root or http://hg.python.org/cpython/rev/96e543ba96a4
History
Date User Action Args
2022-04-11 14:57:44 admin set github: 61946
2013-05-28 13:13:16 serhiy.storchaka set status: open -> closedresolution: fixedstage: patch review -> resolved
2013-05-28 12:56:32 python-dev set nosy: + python-devmessages: +
2013-05-26 07:13:35 serhiy.storchaka set assignee: serhiy.storchaka
2013-05-26 06:55:50 serhiy.storchaka set files: + test_shutil_skip_test_non_matching_mode.patchmessages: + components: + Tests, - Library (Lib)keywords: + patchstage: needs patch -> patch review
2013-05-26 06:12:05 serhiy.storchaka link issue18061 dependencies
2013-04-16 10:39:57 doko link issue17750 dependencies
2013-04-16 10:23:10 doko set nosy: + dokomessages: +
2013-04-16 09:19:35 serhiy.storchaka set nosy: + tarek, hynek, serhiy.storchakastage: needs patchcomponents: + Library (Lib), - Testsversions: + Python 3.4
2013-04-16 08:14:25 jibel set messages: +
2013-04-16 08:13:18 jibel create