Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
x612skm committed Sep 13, 2024
1 parent 19a4c70 commit 83559c1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
13 changes: 0 additions & 13 deletions mypy/test/testreports.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,3 @@ def test_as_xml(self) -> None:
assert_equal(
expected_output, etree.tostring(cobertura_package.as_xml(), pretty_print=True)
)
with tempfile.TemporaryDirectory() as tempdir:
reports = Reports(data_dir=tempdir, report_dirs={"dummy_report": tempdir})

cobertura_reporter = CoberturaXmlReporter(reports, ".")
cobertura_reporter.root_package = cobertura_package
cobertura_reporter.on_finish()

# Convert the XML document to a string
xml_str = etree.tostring(cobertura_reporter.doc, pretty_print=True).decode("utf-8")

# Check that the required attributes are present
assert f'lines-covered="{cobertura_package.covered_lines}"' in xml_str
assert f'lines-valid="{cobertura_package.total_lines}"' in xml_str
4 changes: 2 additions & 2 deletions test-data/unit/reports.test
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def bar() -> str:
def untyped_function():
return 42
[outfile build/cobertura.xml]
<coverage timestamp="$TIMESTAMP" version="$VERSION" line-rate="0.7500" branch-rate="0">
<coverage timestamp="$TIMESTAMP" version="$VERSION" line-rate="0.7500" branch-rate="0" lines-covered="6" lines-valid="8">
<sources>
<source>$PWD</source>
</sources>
Expand Down Expand Up @@ -81,7 +81,7 @@ def foo(a: int) -> MyDict:
return {"a": a}
md: MyDict = MyDict(**foo(42))
[outfile build/cobertura.xml]
<coverage timestamp="$TIMESTAMP" version="$VERSION" line-rate="1.0000" branch-rate="0">
<coverage timestamp="$TIMESTAMP" version="$VERSION" line-rate="1.0000" branch-rate="0" lines-covered="6" lines-valid="6">
<sources>
<source>$PWD</source>
</sources>
Expand Down

0 comments on commit 83559c1

Please sign in to comment.