diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_arcs.py | 2 | ||||
| -rw-r--r-- | tests/test_lcov.py | 36 |
2 files changed, 27 insertions, 11 deletions
diff --git a/tests/test_arcs.py b/tests/test_arcs.py index d0e840af..d907e8c7 100644 --- a/tests/test_arcs.py +++ b/tests/test_arcs.py @@ -158,6 +158,8 @@ class SimpleArcTest(CoverageTest): if env.JYTHON: # Jython reports no lines for an empty file. arcz_missing=".1 1." # pragma: only jython + elif env.PYBEHAVIOR.empty_is_empty: + arcz_missing=".1 1." else: # Other Pythons report one line. arcz_missing="" diff --git a/tests/test_lcov.py b/tests/test_lcov.py index f31d8c17..09bb99aa 100644 --- a/tests/test_lcov.py +++ b/tests/test_lcov.py @@ -8,6 +8,7 @@ import textwrap from tests.coveragetest import CoverageTest import coverage +from coverage import env class LcovTest(CoverageTest): @@ -252,7 +253,8 @@ class LcovTest(CoverageTest): line. It will also note the lack of branches, and the checksum for the line. - Although there are no lines found, it will note one line as hit. + Although there are no lines found, it will note one line as hit in + old Pythons, and no lines hit in newer Pythons. """ self.make_file("__init__.py", "") @@ -261,15 +263,27 @@ class LcovTest(CoverageTest): self.start_import_stop(cov, "__init__") cov.lcov_report() self.assert_exists("coverage.lcov") - expected_result = textwrap.dedent("""\ - TN: - SF:__init__.py - DA:1,1,1B2M2Y8AsgTpgAmY7PhCfg - LF:0 - LH:1 - BRF:0 - BRH:0 - end_of_record - """) + # Newer Pythons have truly empty empty files. + if env.PYBEHAVIOR.empty_is_empty: + expected_result = textwrap.dedent("""\ + TN: + SF:__init__.py + LF:0 + LH:0 + BRF:0 + BRH:0 + end_of_record + """) + else: + expected_result = textwrap.dedent("""\ + TN: + SF:__init__.py + DA:1,1,1B2M2Y8AsgTpgAmY7PhCfg + LF:0 + LH:1 + BRF:0 + BRH:0 + end_of_record + """) actual_result = self.get_lcov_report_content() assert actual_result == expected_result |
