Commits

Travis Shirk  committed 5c80cfe

Added --coverage as a test option, not on by default now.

  • Participants
  • Parent commits 1ec9ad5
  • Branches stable

Comments (0)

Files changed (1)

        endoutput='{{{end}}}',
        includedir=path(__file__).abspath().dirname(),
    ),
+
+   test=Bunch(
+       debug=False,
+       coverage=False,
+   ),
 )
 
 @task
 
 @task
 @needs("build")
-@cmdopts([("debug", u"",
-           u"Run with all output and launch pdb for errors and failures")])
+@cmdopts([("debug", "",
+           u"Run with all output and launch pdb for errors and failures"),
+          ("coverage", "", u"Run tests with coverage analysis"),
+         ])
 def test(options):
     '''Runs all tests'''
     if options.test and options.test.debug:
     else:
         debug_opts = ""
 
-    sh("nosetests --verbosity=3 --detailed-errors %(debug_opts)s "
-       "--cover-erase --with-coverage --cover-tests --cover-inclusive "
-       "--cover-package=eyed3 --cover-branches --cover-html "
-       "--cover-html-dir=build/test/coverage src/test" %
-       {"debug_opts": debug_opts})
-    print("Coverage Report: file://%s/build/test/coverage/index.html" %
-          os.getcwd())
+    if options.test and options.test.coverage:
+        coverage_opts = (
+            "--cover-erase --with-coverage --cover-tests --cover-inclusive "
+            "--cover-package=eyed3 --cover-branches --cover-html "
+            "--cover-html-dir=build/test/coverage src/test")
+    else:
+        coverage_opts = ""
+
+    sh("nosetests --verbosity=1 --detailed-errors "
+       "%(debug_opts)s %(coverage_opts)s" %
+       {"debug_opts": debug_opts, "coverage_opts": coverage_opts})
+
+    if coverage_opts:
+        print("Coverage Report: file://%s/build/test/coverage/index.html" %
+              os.getcwd())
 
 @task
 def test_clean():