[py-svn] pytest-coverage commit 039446d6637f: adding a test and the option for --cover-package
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Wed Feb 10 21:11:14 CET 2010
# HG changeset patch -- Bitbucket.org
# Project pytest-coverage
# URL http://bitbucket.org/prologic/pytest-coverage/overview/
# User holger krekel <holger at merlinux.eu>
# Date 1265832660 -3600
# Node ID 039446d6637fb9d5f85ea91f1fbbbdb3b77b9f0b
# Parent de6277ef78cf755f600c03ce485bf28ca97778a3
adding a test and the option for --cover-package
--- a/test_pytest_coverage.py
+++ b/test_pytest_coverage.py
@@ -31,3 +31,20 @@ def test_coverage_is_not_imported(testdi
'*1 passed*',
])
#print result.stdout.str()
+
+def test_cover_package(testdir):
+ testdir.makepyfile("""
+ def f():
+ x = 42
+ def test_whatever():
+ pass
+ """)
+ result = testdir.runpytest('--cover-package=test_cover_package',
+ '--cover-action=report')
+ assert result.ret == 0
+ assert result.stdout.fnmatch_lines([
+ '*Processing Coverage*',
+ 'test_cover_package*4*3*75%*',
+ ])
+ s = result.stdout.str()
+ assert 'py/_test' not in s, "other packages were not excluded!"
--- a/pytest_coverage.py
+++ b/pytest_coverage.py
@@ -10,9 +10,6 @@ import py
def pytest_addoption(parser):
group = parser.getgroup('Coverage options')
- group.addoption('--cover-show-missing', action='store', default=None,
- dest='show_missing',
- help='Show missing files')
group.addoption('--cover-action', action='store', default=None,
dest='coverage', type="choice",
choices=['report', 'annotate', 'html'],
@@ -24,6 +21,13 @@ def pytest_addoption(parser):
group.addoption('--cover-directory', action='store', default=None,
dest='directory',
help='Directory for the reports (html / annotate results) defaults to ./coverage')
+ group.addoption('--cover-show-missing', action='store', default=None,
+ dest='show_missing',
+ help='Show missing files')
+ group.addoption('--cover-package', action='append', default=[],
+ dest='coverpackage',
+ help='(multi allowed) only include info from specified package.')
+
group.addoption('--cover-ignore-errors', action='store', default=None,
dest='ignore_errors',
help='Ignore errors')
More information about the pytest-commit
mailing list