dougn / coverage_pth

Installs a .pth file which enables coverage for all of python
BSD 2-Clause "Simplified" License
5 stars 5 forks source link

problem with --editable coveragepy #1

Open tarpas opened 9 years ago

tarpas commented 9 years ago

Hi and thanks for a nice solution!

Here are the steps to reproduce a problem which might be quite common:

hg clone https://bitbucket.org/ned/coveragepy

pip install --editable coveragepy

pip install coverage_pth

python

Traceback (most recent call last):
  File "/Users/tibor/.virtualenvs/test2/bin/../lib/python2.7/site.py", line 703, in <module>
    main()
  File "/Users/tibor/.virtualenvs/test2/bin/../lib/python2.7/site.py", line 683, in main
    paths_in_sys = addsitepackages(paths_in_sys)
  File "/Users/tibor/.virtualenvs/test2/bin/../lib/python2.7/site.py", line 282, in addsitepackages
    addsitedir(sitedir, known_paths)
  File "/Users/tibor/.virtualenvs/test2/bin/../lib/python2.7/site.py", line 204, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "/Users/tibor/.virtualenvs/test2/bin/../lib/python2.7/site.py", line 173, in addpackage
    exec(line)
  File "<string>", line 1, in <module>
ImportError: No module named coverage
dougn commented 9 years ago

Odd, when installed in editable form, I would have expected that coverage would still be usable as a module. That is kind of the point. I am not sure why it is not finding it (yet) at the site.py time. I think this is related to how pip manages the editable PYTHONPATH extensions.

tarpas commented 9 years ago

Yeah,

this works in the scenerio I described: https://github.com/dougn/coverage_pth/compare/master...tarpas:563870fc9728281dc62eff24f468e1de828ec063

(naming the pth file az y0_coverage_pth.pth)

But it can't have coveragepy in install_requires ..

I'm not sure it's worth solving though.. see also: https://bitbucket.org/ned/coveragepy/issue/367/automating-the-subprocess-measurement

On Fri, Apr 24, 2015 at 10:48 PM, Doug Napoleone notifications@github.com wrote:

Odd, when installed in editable form, I would have expected that coverage would still be usable as a module. That is kind of the point. I am not sure why it is not finding it (yet) at the site.py time. I think this is related to how pip manages the editable PYTHONPATH extensions.

— Reply to this email directly or view it on GitHub https://github.com/dougn/coverage_pth/issues/1#issuecomment-96060992.