From df82a9638cd8fbe8a33c5969ff9c0d348d069adb Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Mon, 23 Dec 2019 15:45:39 -0500 Subject: Use abspath to rc file so that chdir doesn't bork us. #890 --- coverage/config.py | 5 +++-- coverage/multiproc.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'coverage') diff --git a/coverage/config.py b/coverage/config.py index 452d320e..78a3e86a 100644 --- a/coverage/config.py +++ b/coverage/config.py @@ -6,6 +6,7 @@ import collections import copy import os +import os.path import re from coverage import env @@ -275,7 +276,7 @@ class CoverageConfig(object): if not files_read: return False - self.config_files_read.extend(files_read) + self.config_files_read.extend(map(os.path.abspath, files_read)) any_set = False try: @@ -323,7 +324,7 @@ class CoverageConfig(object): used = any_set if used: - self.config_file = filename + self.config_file = os.path.abspath(filename) with open(filename) as f: self._config_contents = f.read() diff --git a/coverage/multiproc.py b/coverage/multiproc.py index c466301f..2931b3be 100644 --- a/coverage/multiproc.py +++ b/coverage/multiproc.py @@ -6,6 +6,7 @@ import multiprocessing import multiprocessing.process import os +import os.path import sys import traceback @@ -85,7 +86,7 @@ def patch_multiprocessing(rcfile): # Set the value in ProcessWithCoverage that will be pickled into the child # process. - os.environ["COVERAGE_RCFILE"] = rcfile + os.environ["COVERAGE_RCFILE"] = os.path.abspath(rcfile) # When spawning processes rather than forking them, we have no state in the # new process. We sneak in there with a Stowaway: we stuff one of our own -- cgit v1.2.1