Skip to content

Commit 6e2195b

Browse files
committed
test: add a test for #1407
1 parent c69c00c commit 6e2195b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/test_summary.py

+24
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,30 @@ def test_report_including(self):
138138
assert "mycode.py " in report
139139
assert self.last_line_squeezed(report) == "TOTAL 4 0 100%"
140140

141+
def test_omit_files_here(self):
142+
# https://github.com/nedbat/coveragepy/issues/1407
143+
self.make_file("foo.py", "")
144+
self.make_file("bar/bar.py", "")
145+
self.make_file("tests/test_baz.py", """\
146+
def test_foo():
147+
assert True
148+
test_foo()
149+
""")
150+
self.run_command("coverage run --source=. --omit='./*.py' -m tests.test_baz")
151+
report = self.report_from_command("coverage report")
152+
153+
# Name Stmts Miss Cover
154+
# ---------------------------------------
155+
# tests/test_baz.py 3 0 100%
156+
# ---------------------------------------
157+
# TOTAL 3 0 100%
158+
159+
assert self.line_count(report) == 5
160+
assert "foo" not in report
161+
assert "bar" not in report
162+
assert "tests/test_baz.py" in report
163+
assert self.last_line_squeezed(report) == "TOTAL 3 0 100%"
164+
141165
def test_run_source_vs_report_include(self):
142166
# https://github.com/nedbat/coveragepy/issues/621
143167
self.make_file(".coveragerc", """\

0 commit comments

Comments
 (0)