pth test malfunctions if venv happens to have no pth files

Issue #339 resolved
Buck Evan created an issue

Quick fix was:

touch /home/buck/venv/coverage.py/lib/python2.7/site-packages/noop.pth

The problem is that the test us using exists(glob('*.pth')) as a heuristic for finding the site-packages directory, but there are better ways:

>>> from distutils.sysconfig import get_python_lib
>>> get_python_lib()
'/home/buck/venv/coverage.py/lib/python2.7/site-packages'

Even .endswith("/site-packages") would be more reliable, in my opinion.

Comments (3)

  1. Ned Batchelder repo owner

    Hmm, just using get_python_lib failed on 3.3 and 3.4. I've changed it to use the existing method, and then try get_python_lib if necessary. But it makes me uneasy, I don't understand how to create an environment like the one that caused the original failure.

  2. Log in to comment