diff options
-rw-r--r-- | functional_tests/test_coverage_plugin.py | 7 | ||||
-rw-r--r-- | nose/plugins/cover.py | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/functional_tests/test_coverage_plugin.py b/functional_tests/test_coverage_plugin.py index 3242695..d58a519 100644 --- a/functional_tests/test_coverage_plugin.py +++ b/functional_tests/test_coverage_plugin.py @@ -1,5 +1,6 @@ """Test the coverage plugin.""" import os +import sys import unittest import shutil @@ -10,7 +11,11 @@ support = os.path.join(os.path.dirname(__file__), 'support') try: import coverage - hasCoverage = True + + # Python 3.3 may accidentally pick up our support area when running the unit + # tests. Look for the coverage attribute to make sure we've got the right + # package. + hasCoverage = hasattr(coverage, 'coverage') except ImportError: hasCoverage = False diff --git a/nose/plugins/cover.py b/nose/plugins/cover.py index f1f53c8..d041251 100644 --- a/nose/plugins/cover.py +++ b/nose/plugins/cover.py @@ -104,6 +104,8 @@ class Coverage(Plugin): if self.enabled: try: import coverage + if not hasattr(coverage, 'coverage'): + raise ImportError("Unable to import coverage module") except ImportError: log.error("Coverage not available: " "unable to import coverage module") |