diff --git a/coverage_pyver_pragma/grammar.py b/coverage_pyver_pragma/grammar.py index a2db3ef..91f2a73 100644 --- a/coverage_pyver_pragma/grammar.py +++ b/coverage_pyver_pragma/grammar.py @@ -120,6 +120,7 @@ # stdlib import platform +import sys # 3rd party import packaging.specifiers @@ -156,6 +157,17 @@ "GRAMMAR", ] +# This ensures coverage.py records the correct coverage for these modules +# when they are under test + +for module in [ + "domdf_python_tools", + "domdf_python_tools.doctools", + "domdf_python_tools.stringlist", + ]: + if module in sys.modules: + del sys.modules[module] + @prettify_docstrings class VersionTag(packaging.specifiers.SpecifierSet):