Permalink
Browse files

Correct how we eliminate test coverage... coverage so that we dont sk…

…ip multiple tests in new files
  • Loading branch information...
1 parent 777b3ba commit 9e4fc14571caf71934b92861b72000243083c085 @dcramer committed Feb 20, 2012
Showing with 8 additions and 3 deletions.
  1. +7 −2 quickunit/plugin.py
  2. +1 −1 setup.py
View
@@ -166,6 +166,8 @@ def begin(self):
for prefix in self.prefixes:
self.pending_files.add(os.path.join(prefix, new_filename.rsplit('.', 1)[0]))
+ self.tests_run = set()
+
if self.verbosity > 1:
self.logger.info("Found %d changed file(s) and %d possible test paths..", len(diff), len(self.pending_files))
@@ -178,6 +180,7 @@ def wantMethod(self, method):
if self.root and filename.startswith(self.root):
filename = filename[len(self.root):]
+ # check to see if this is a modified test
diff_data = self.diff_data[filename]
if diff_data:
lines, startlineno = inspect.getsourcelines(method)
@@ -186,12 +189,12 @@ def wantMethod(self, method):
# Remove it from the coverage data
for prefix in self.prefixes:
if filename.startswith(prefix):
- del self.diff_data[filename]
+ self.tests_run.add(filename)
return True
for prefix in self.prefixes:
if filename.startswith(prefix):
- del self.diff_data[filename]
+ self.tests_run.add(filename)
for pending in self.pending_files:
if filename.startswith(pending):
return True
@@ -256,6 +259,8 @@ def _report_test_coverage(self, stream):
for test, coverage in cov_data.iteritems():
for filename, covered_linenos in coverage.iteritems():
+ if filename in self.tests_run:
+ continue
linenos = diff_data[filename]
total += len(linenos)
View
@@ -7,7 +7,7 @@
setup(
name='nose-quickunit',
- version='0.4.3',
+ version='0.4.4',
author='David Cramer',
author_email='dcramer@gmail.com',
description='A discovery plugin for Nose which relies on sane structure.',

0 comments on commit 9e4fc14

Please sign in to comment.