diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2012-12-08 23:55:10 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2012-12-08 23:55:10 -0500 |
commit | f8aaec370e6cfd104d026b326d0a33918dbe2bc2 (patch) | |
tree | 8f11d0c5a6a37bd6eb45df82ddba9b0e12c505de /coverage/control.py | |
parent | be6693a25123d8e8cf80aca5cb9a73a8f81dd584 (diff) | |
download | python-coveragepy-git-f8aaec370e6cfd104d026b326d0a33918dbe2bc2.tar.gz |
Fix the blunt hack
Diffstat (limited to 'coverage/control.py')
-rw-r--r-- | coverage/control.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/coverage/control.py b/coverage/control.py index 44837f14..1a475a58 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" |