classification
Title: test_site assumes that site.ENABLE_USER_SITE is True
Type: Stage: resolved
Components: Tests Versions: Python 3.3, Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ned.deily Nosy List: carljm, ned.deily, python-dev
Priority: normal Keywords: patch

Created on 2011-10-31 18:31 by carljm, last changed 2011-10-31 23:25 by ned.deily. This issue is now closed.

Files
File name Uploaded Description Edit
d851c64c745a.diff carljm, 2011-10-31 19:51 review
Repositories containing patches
http://bitbucket.org/carljm/cpython#issue13304
Messages (4)
msg146722 - (view) Author: Carl Meyer (carljm) * Date: 2011-10-31 18:31
If the test suite is run with PYTHONNOUSERSITE=true, the test_s_option test in test_site fails, because it implicitly assumes that site.ENABLE_USER_SITE is True and that site.USER_SITE should unconditionally be in sys.path.

This is a practical problem in the reference implementation for PEP 404, as the tests should pass when run from within a virtual environment, but a system-isolated virtual environment disables user-site (i.e. has the same effect as PYTHONNOUSERSITE).

I think the correct fix here is to conditionally skip that test if site.ENABLE_USER_SITE is not True.

I also think the module-level conditional check at the top of the file, which, if site.USER_SITE does not exist, creates site.USER_SITE and calls site.addsitedir() on it, should only run if site.ENABLE_USER_SITE is True.
msg146735 - (view) Author: Carl Meyer (carljm) * Date: 2011-10-31 19:26
Added a patch implementing my proposed fix.
msg146753 - (view) Author: Roundup Robot (python-dev) Date: 2011-10-31 23:23
New changeset 1689b9cf6b1c by Ned Deily in branch '2.7':
Issue #13304: Skip test case if user site-packages disabled (-s or
http://hg.python.org/cpython/rev/1689b9cf6b1c

New changeset c497011a4769 by Ned Deily in branch '3.2':
Issue #13304: Skip test case if user site-packages disabled (-s or
http://hg.python.org/cpython/rev/c497011a4769

New changeset c343c095d08b by Ned Deily in branch 'default':
Issue #13304: Skip test case if user site-packages disabled (-s or
http://hg.python.org/cpython/rev/c343c095d08b
msg146754 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-10-31 23:25
LGTM. Thanks for the patch!  Committed to 27 (for release in 2.7.3), 32 (3.2.3), and default (3.3).
History
Date User Action Args
2011-10-31 23:25:41ned.deilysetstatus: open -> closed

assignee: ned.deily
versions: + Python 2.7, Python 3.2, Python 3.3
nosy: + ned.deily

messages: + msg146754
resolution: fixed
stage: resolved
2011-10-31 23:23:56python-devsetnosy: + python-dev
messages: + msg146753
2011-10-31 19:51:15carljmsetfiles: + d851c64c745a.diff
2011-10-31 19:32:06carljmsetfiles: - cea40c2d7323.diff
2011-10-31 19:27:15carljmsetfiles: + cea40c2d7323.diff
keywords: + patch
2011-10-31 19:26:10carljmsethgrepos: + hgrepo87
messages: + msg146735
2011-10-31 18:31:07carljmcreate