summaryrefslogtreecommitdiff
path: root/coverage
diff options
context:
space:
mode:
Diffstat (limited to 'coverage')
-rw-r--r--coverage/control.py6
-rw-r--r--coverage/debug.py14
2 files changed, 8 insertions, 12 deletions
diff --git a/coverage/control.py b/coverage/control.py
index 2ee2c933..2130de39 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -197,12 +197,6 @@ class Coverage(object):
# Create and configure the debugging controller. COVERAGE_DEBUG_FILE
# is an environment variable, the name of a file to append debug logs
# to.
- if self._debug_file is None:
- debug_file_name = os.environ.get("COVERAGE_DEBUG_FILE")
- if debug_file_name:
- self._debug_file = open(debug_file_name, "a")
- else:
- self._debug_file = sys.stderr
self._debug = DebugControl(self.config.debug, self._debug_file)
# _exclude_re is a dict that maps exclusion list names to compiled regexes.
diff --git a/coverage/debug.py b/coverage/debug.py
index 67a45ce1..442fb1de 100644
--- a/coverage/debug.py
+++ b/coverage/debug.py
@@ -35,17 +35,17 @@ class DebugControl(object):
def __init__(self, options, output):
"""Configure the options and output file for debugging."""
self.options = list(options) + FORCED_DEBUG
- self.raw_output = output
self.suppress_callers = False
filters = []
if self.should('pid'):
filters.append(add_pid_and_tid)
- self.output = DebugOutputFile(
- self.raw_output,
+ self.output = DebugOutputFile.the_one(
+ output,
show_process=self.should('process'),
filters=filters,
)
+ self.raw_output = self.output.outfile
def __repr__(self):
return "<DebugControl options=%r raw_output=%r>" % (self.options, self.raw_output)
@@ -253,10 +253,12 @@ class DebugOutputFile(object): # pragma: debugging
# on a class attribute. Yes, this is aggressively gross.
the_one = sys.modules.get(cls.SYS_MOD_NAME)
if the_one is None:
- with open("/tmp/where.txt", "a") as f:
- f.write("Starting with {}\n".format(fileobj))
if fileobj is None:
- fileobj = open("/tmp/debug_log.txt", "a")
+ debug_file_name = os.environ.get("COVERAGE_DEBUG_FILE")
+ if debug_file_name:
+ fileobj = open(debug_file_name, "a")
+ else:
+ fileobj = sys.stderr
sys.modules[cls.SYS_MOD_NAME] = the_one = cls(fileobj, show_process, filters)
return the_one