ci: add strict-no-cover to detect unnecessary coverage pragmas (#1897)

This commit is contained in:
Max Isbey 2026-01-23 20:00:20 +00:00 • committed by GitHub
commit a7ddfdae07
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -18,9 +18,9 @@ def temp_file():
f.write(content)
path = Path(f.name).resolve()
yield path
try: # pragma: no cover
try: # pragma: lax no cover
path.unlink()
except FileNotFoundError: # pragma: no cover
except FileNotFoundError: # pragma: lax no cover
pass # File was already deleted by the test
@ -101,7 +101,7 @@ class TestFileResource:
@pytest.mark.skipif(os.name == "nt", reason="File permissions behave differently on Windows")
@pytest.mark.anyio
async def test_permission_error(self, temp_file: Path): # pragma: no cover
async def test_permission_error(self, temp_file: Path): # pragma: lax no cover
"""Test reading a file without permissions."""
temp_file.chmod(0o000) # Remove all permissions
try: