From 8f9775f24a9ee56c29131456abea42f945ba2516 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Mon, 23 Dec 2024 08:08:33 -0500 Subject: [PATCH] wip: add a test for #1874 --- tests/test_lcov.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_lcov.py b/tests/test_lcov.py index fa360501a..76e99e91d 100644 --- a/tests/test_lcov.py +++ b/tests/test_lcov.py @@ -572,3 +572,19 @@ def fun(x): cov.lcov_report() lcov = self.get_lcov_report_content() assert "BRDA:2,0,return from function 'fun',-" in lcov + + def test_module_exit(self) -> None: + self.make_file("modexit.py", """\ + #! /usr/bin/env python + def foo(): + return bar( + ) + if "x" == "y": # line 5 + foo() + """) + cov = coverage.Coverage(source=".", branch=True) + self.start_import_stop(cov, "modexit") + cov.lcov_report() + lcov = self.get_lcov_report_content() + print(lcov) + assert "BRDA:5,0,exit the module,1" in lcov