Skip to content

Commit 6e097e2

Browse files
committed
Make sure config path is absulutized early. Fixes failures in finish (where now we reinitialize the cov object for forced combine) that are caused by sloppy cwd changes (crazy stuff ppl put in tests).
1 parent e77500c commit 6e097e2

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/pytest_cov/engine.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def __init__(self, cov_source, cov_report, cov_config, cov_append, config=None,
1818
"""Get some common config used by multiple derived classes."""
1919
self.cov_source = cov_source
2020
self.cov_report = cov_report
21-
self.cov_config = cov_config
21+
self.cov_config = os.path.abspath(cov_config)
2222
self.cov_append = cov_append
2323
self.config = config
2424
self.nodeid = nodeid
@@ -34,9 +34,8 @@ def set_env(self):
3434
os.environ['COV_CORE_SOURCE'] = ''
3535
else:
3636
os.environ['COV_CORE_SOURCE'] = os.pathsep.join(self.cov_source)
37-
config_file = os.path.abspath(self.cov_config)
38-
if os.path.exists(config_file):
39-
os.environ['COV_CORE_CONFIG'] = config_file
37+
if os.path.exists(self.cov_config):
38+
os.environ['COV_CORE_CONFIG'] = self.cov_config
4039
else:
4140
os.environ['COV_CORE_CONFIG'] = ''
4241
os.environ['COV_CORE_DATAFILE'] = os.path.abspath('.coverage')

0 commit comments

Comments
 (0)