Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Adds a coveragerc file #193

Merged
merged 3 commits into from
Oct 2, 2015
Merged

Adds a coveragerc file #193

merged 3 commits into from
Oct 2, 2015

Conversation

embray
Copy link
Member

@embray embray commented Sep 30, 2015

Add a coveragerc to tweak the coverage report somewhat. Excludes a few files from the report (not making a huge impact on the overall coverage score, but the rest are things that should be tested...

…w files from the report (not making a huge impact on the overall coverage score, but the rest are things that should be tested...
@embray embray added this to the v1.1 milestone Sep 30, 2015
@embray
Copy link
Member Author

embray commented Sep 30, 2015

Weird....travis-ci tests mysteriously failed on Python 2.6. This should have nothing to do with this PR--probably something in the build changed.

I can't reproduce locally...

@embray
Copy link
Member Author

embray commented Sep 30, 2015

The appveyor test on Python 2.6 worked fine too...

@embray
Copy link
Member Author

embray commented Oct 1, 2015

Okay, I was able to reproduce this. It actually really does fail on Python 2.6 when adding the --cov-config option and works fine without it. Very strange. Might just disable it on Python 2.6 and move on...

@embray
Copy link
Member Author

embray commented Oct 1, 2015

Interesting...

Traceback (most recent call last):
  File "/home/embray/miniconda/envs/test/lib/python2.6/site.py", line 525, in <module>
    main()
  File "/home/embray/miniconda/envs/test/lib/python2.6/site.py", line 508, in main
    known_paths = addsitepackages(known_paths)
  File "/home/embray/miniconda/envs/test/lib/python2.6/site.py", line 288, in addsitepackages
    addsitedir(sitedir, known_paths)
  File "home/embray/miniconda/envs/test/lib/python2.6/site.py", line 185, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "/home/embray/miniconda/envs/test/lib/python2.6/site.py", line 155, in addpackage
    exec line
  File "<string>", line 1, in <module>
  File "<string>", line 4, in <module>
  File "/home/embray/miniconda/envs/test/lib/python2.6/site-packages/pytest_cov/embed.py", line 58, in init
    auto_data=True)
  File "/home/embray/miniconda/envs/test/lib/python2.6/site-packages/coverage/control.py", line 138, in __init__
    "Couldn't read '%s' as a config file" % config_file
coverage.misc.CoverageException: Couldn't read 'astropy_helpers/tests/coveragerc' as a config file

@embray
Copy link
Member Author

embray commented Oct 1, 2015

Okay, interesting, and subtle. This has to do with recent updates to pytest-cov that enables it, in a clever but hackish way, to collect coverage data on code run in subprocesses. However, this hack breaks in a bad way if the path you give to the coveragerc file is a relative path, and your test changes directories before running the subprocess.

The breakage actually occurs very early on in the Python interpreter startup (for the subprocess) in site.py--Python 2.7 and up are able to ignore the exception and resume startup, but Python 2.6's site.py is less flexible and it will crash the whole interpeter startup if an unhandled exception occurs while processing a .pth file.

I'll report this to pytest-cov. As a workaround, for now, I think I can pass a full path in for the config file.

embray added a commit that referenced this pull request Oct 2, 2015
@embray embray merged commit 8888a23 into astropy:master Oct 2, 2015
@embray embray deleted the coveragerc branch October 2, 2015 20:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants