You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As I documented over in astropy/astropy-helpers#193, if I specify a relative path to a coveragerc file with the --cov-config option, and then one of my tests changes to a different directory and starts a subprocess, then an exception occurs during processing of the pytest-cov.pth file:
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
This is because the relative path is written into the COV_CORE_CONFIG environment variable. So after changing directories that file cannot be found and we get a crash upon trying to process it.
On most Python versions this exception is ignored in site.py (so the coverage feature is still broken, but otherwise the tests pass). On Python 2.6, however, the exception is not ignored and the tests fail too.
A simple workaround would be to always store the path to the config file as an absolute path.
The text was updated successfully, but these errors were encountered:
Use absolute paths for coverage config file and sources. Add a new internal variable "COV_CORE_DATAFILE" to workaround the misplacement of .coverage.foobar.123 files.
Because needs to be an absolute path COV_CORE_CONFIG we need to do some special things: coverage treats config_file='.coveragerc' as if it was config_file=True. We need to keep that behavior.
Closes#94. Closes#77.
As I documented over in astropy/astropy-helpers#193, if I specify a relative path to a coveragerc file with the
--cov-config
option, and then one of my tests changes to a different directory and starts a subprocess, then an exception occurs during processing of the pytest-cov.pth file:This is because the relative path is written into the
COV_CORE_CONFIG
environment variable. So after changing directories that file cannot be found and we get a crash upon trying to process it.On most Python versions this exception is ignored in site.py (so the coverage feature is still broken, but otherwise the tests pass). On Python 2.6, however, the exception is not ignored and the tests fail too.
A simple workaround would be to always store the path to the config file as an absolute path.
The text was updated successfully, but these errors were encountered: