Commits

Anonymous committed 15f9851

Changes to cov option, reporting and imports.

Change cov option to work on filesystem paths and make the help
text more clear.

Change reporting to indicating files and dirs written to. Also
output warning if nothing to report on.

Minimise imports by only importing if actually needed.

  • Participants
  • Parent commits 4239746

Comments (0)

Files changed (2)

 import setuptools
 
 setuptools.setup(name='unittest2-cov',
-                 version='1.0a2',
-                 description='unittest2 plugin for coverage reporting',
+                 version='1.0a3',
+                 description='unittest2 plugin for coverage reporting, including subprocesses',
                  long_description=open('README.txt').read().strip(),
                  author='Meme Dough',
                  author_email='memedough@gmail.com',
                  url='http://bitbucket.org/memedough/unittest2-cov/overview',
                  py_modules=['unittest2_cov'],
-                 install_requires=['cov-core>=1.0'],
+                 install_requires=['cov-core>=1.1'],
                  license='MIT License',
                  zip_safe=False,
                  keywords='unittest2 cover coverage',

File unittest2_cov.py

 """Coverage plugin for unittest2."""
 
-import cov_core
 import unittest2
-import StringIO
-import sys
 
 class CovPlugin(unittest2.events.Plugin):
 
         self.covReport = self.ourOptions.as_list('cov-report', default=[])
         self.covConfig = self.ourOptions.get('cov-config', '.coverage').strip()
 
-        unittest2.events.addOption(self.covSource, None, 'cov', 'Measure coverage for selected dirs')
+        unittest2.events.addOption(self.covSource, None, 'cov', 'Measure coverage for filesystem path')
         unittest2.events.addOption(self.covReport, None, 'cov-report', 'Generate selected reports, available types: term, term-missing, annotate, html, xml')
         unittest2.events.addOption(self.covConfig, None, 'cov-config', 'Config file for coverage, default: .coveragerc')
 
         """If we are enabled then start coverage."""
 
         if self.covSource:
+            import cov_core
             self.covReport = self.covReport or ['term']
             self.covController = cov_core.Central(self.covSource, self.covReport, self.covConfig)
             self.covController.start()
         """If we are enabled then produce coverage reports."""
 
         if self.covSource:
+            import StringIO
+            import sys
             stream = StringIO.StringIO()
             self.covController.finish()
             self.covController.summary(stream)