summaryrefslogtreecommitdiff
path: root/coverage/control.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2012-12-08 23:55:10 -0500
committerNed Batchelder <ned@nedbatchelder.com>2012-12-08 23:55:10 -0500
commite1ab382e3fa39df317509dcb0a4ccd3d626a29f1 (patch)
treeb9679b048bd02b3088f9acbf40f3a39bde6aa040 /coverage/control.py
parentabbe25422431ea801a43c3f8e5744354a2456c63 (diff)
downloadpython-coveragepy-e1ab382e3fa39df317509dcb0a4ccd3d626a29f1.tar.gz
Fix the blunt hack
Diffstat (limited to 'coverage/control.py')
-rw-r--r--coverage/control.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/coverage/control.py b/coverage/control.py
index 44837f1..1a475a5 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -435,14 +435,16 @@ class coverage(object):
# plenty of distinguishing information. We do this here in
# `save()` at the last minute so that the pid will be correct even
# if the process forks.
- data_suffix = "%s.%s.%06d" % (
- socket.gethostname(), os.getpid(),
+ extra = ""
+ if _TEST_NAME_FILE:
+ f = open(_TEST_NAME_FILE)
+ test_name = f.read()
+ f.close()
+ extra = "." + test_name
+ data_suffix = "%s%s.%s.%06d" % (
+ socket.gethostname(), extra, os.getpid(),
random.randint(0, 999999)
)
- if _TEST_NAME_FILE:
- with open(_TEST_NAME_FILE) as f:
- test_name = f.read()
- data_suffix += "." + test_name
self._harvest_data()
self.data.write(suffix=data_suffix)
@@ -707,4 +709,4 @@ def process_startup():
cov._warn_no_data = False
-_TEST_NAME_FILE = "" # r"c:\foo\covtest.txt"
+_TEST_NAME_FILE = "/tmp/covtest.txt" # r"c:\foo\covtest.txt"