[issue17746] test_shutil.TestWhich.test_non_matching_mode fails when running as root

Jean-Baptiste Lallement report at bugs.python.org
Tue Apr 16 10:13:18 CEST 2013


New submission from Jean-Baptiste Lallement:

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

----------
components: Tests
files: test_shutil.log
messages: 187054
nosy: jibel
priority: normal
severity: normal
status: open
title: test_shutil.TestWhich.test_non_matching_mode fails when running as root
versions: Python 3.3
Added file: http://bugs.python.org/file29882/test_shutil.log

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17746>
_______________________________________


More information about the Python-bugs-list mailing list