[TIP] weird coverage problems with subprocesses

Chris Withers chris at simplistix.co.uk
Wed May 27 23:47:03 PDT 2015


Hi Ned,

I'm having some very strange problems when running the tests for 
https://github.com/Simplistix/picky.

picky runs "pip freeze" and "conda list" in a subprocess using POpen and 
so, for testing, I use .py files that generate sample output:

https://github.com/Simplistix/picky/tree/5766972ae4605ed247d2b140a26b9f64559e2c50/picky/tests/sample_output 


Development environment setup is here:

http://picky.readthedocs.org/en/latest/development.html#setting-up-the-environment

When running the tests with nose locally, I get lots of:

nosetests --with-cov --cov=picky

'picky.handlers',
   'ERROR',
   'pip gave errors: Error processing line 1 of 
/Users/chris/.local/lib/python2.7/site-packages/init_cov_core.pth:\n\n 
Traceback (most recent call last):\n    File 
"/Users/chris/anaconda/envs/picky27/lib/python2.7/site.py", line 161, in 
addpackage\n      exec line\n    File "<string>", line 1, in <module>\n  
ImportError: No module named cov_core_init\n\nRemainder of file ignored\n'),

...which makes no sense, as:

$ /usr/bin/env python
Python 2.7.9 |Continuum Analytics, Inc.| (default, Dec 15 2014, 10:37:34)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
 >>> import cov_core_init
 >>>

Now, running on Travis, I get different errors:

https://travis-ci.org/Simplistix/picky/jobs/64213857

The frustrating thing is that I don't get either of these problems when 
running the tests with coverage under PyCharm.

Any ideas?

cheers,

Chris



More information about the testing-in-python mailing list