diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2012-11-11 20:24:18 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2012-11-11 20:24:18 -0500 |
commit | 7fda5e935bb78af2fbc2ff01731d2adb8f6af848 (patch) | |
tree | 5e2b8f9ff19e042f3ec0929fcf6a09ddebc4c38b | |
parent | 199b060ac815c5125e8c8955d4d1fe5d273b641b (diff) | |
download | python-coveragepy-git-7fda5e935bb78af2fbc2ff01731d2adb8f6af848.tar.gz |
Remove odd module holding, since I think this is now fixed by always stopping the tracers.
-rw-r--r-- | coverage/control.py | 15 | ||||
-rw-r--r-- | coverage/data.py | 12 |
2 files changed, 6 insertions, 21 deletions
diff --git a/coverage/control.py b/coverage/control.py index effb4857..20afff5e 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -179,14 +179,6 @@ class coverage(object): # Set the reporting precision. Numbers.set_precision(self.config.precision) - # When tearing down the coverage object, modules can become None. - # Saving the modules as object attributes avoids problems, but it is - # quite ad-hoc which modules need to be saved and which references - # need to use the object attributes. - self.socket = socket - self.os = os - self.random = random - def _canonical_dir(self, f): """Return the canonical directory of the file `f`.""" return os.path.split(self.file_locator.canonical_filename(f))[0] @@ -208,9 +200,6 @@ class coverage(object): should not. """ - if os is None: - return False - if filename.startswith('<'): # Lots of non-file execution is represented with artificial # filenames like "<string>", "<doctest readme.txt[0]>", or @@ -426,8 +415,8 @@ class coverage(object): # `save()` at the last minute so that the pid will be correct even # if the process forks. data_suffix = "%s.%s.%06d" % ( - self.socket.gethostname(), self.os.getpid(), - self.random.randint(0, 99999) + socket.gethostname(), os.getpid(), + random.randint(0, 99999) ) self._harvest_data() diff --git a/coverage/data.py b/coverage/data.py index 7a8d656f..4a79807d 100644 --- a/coverage/data.py +++ b/coverage/data.py @@ -60,10 +60,6 @@ class CoverageData(object): # self.arcs = {} - self.os = os - self.sorted = sorted - self.pickle = pickle - def usefile(self, use_file=True): """Set whether or not to use a disk file for data.""" self.use_file = use_file @@ -101,13 +97,13 @@ class CoverageData(object): def line_data(self): """Return the map from filenames to lists of line numbers executed.""" return dict( - [(f, self.sorted(lmap.keys())) for f, lmap in self.lines.items()] + [(f, sorted(lmap.keys())) for f, lmap in self.lines.items()] ) def arc_data(self): """Return the map from filenames to lists of line number pairs.""" return dict( - [(f, self.sorted(amap.keys())) for f, amap in self.arcs.items()] + [(f, sorted(amap.keys())) for f, amap in self.arcs.items()] ) def write_file(self, filename): @@ -127,7 +123,7 @@ class CoverageData(object): # Write the pickle to the file. fdata = open(filename, 'wb') try: - self.pickle.dump(data, fdata, 2) + pickle.dump(data, fdata, 2) finally: fdata.close() @@ -252,7 +248,7 @@ class CoverageData(object): if fullpath: filename_fn = lambda f: f else: - filename_fn = self.os.path.basename + filename_fn = os.path.basename for filename, lines in self.lines.items(): summ[filename_fn(filename)] = len(lines) return summ |