Browse Source

chore: add testing configs

Sam Jaffe 3 weeks ago
parent
commit
eb67c003b6
1 changed files with 31 additions and 0 deletions
  1. 31 0
      pyproject.toml

+ 31 - 0
pyproject.toml

@@ -18,8 +18,39 @@ dev = [
     "mypy>=1.19.1",
     "pylint>=4.0.5",
     "pytest>=9.0.2",
+    "pytest-cov>=7.1.0",
 ]
 
+[tool.pytest.ini_options]
+pythonpath = [ "src/" ]
+addopts = [ "--cov" ]
+
+[tool.coverage.run]
+branch = true
+source = [ "src/" ]
+
+[tool.coverage.report]
+exclude_also = [
+    # Don't complain about missing debug-only code:
+    "def __repr__",
+    "if self.debug:",
+    "if settings.DEBUG",
+    # Don't complain if tests don't hit defensive assertion code:
+    "raise AssertionError",
+    "raise NotImplementedError",
+    # Don't complain if non-runnable code isn't run:
+    "if 0:",
+    "if __name__ == .__main__.:",
+    "if TYPE_CHECKING:",
+    "class .*\\bProtocol\\):",
+    # Don't complain about abstract methods, they aren't run:
+    "@(abc\\.)?abstractmethod",
+]
+
+fail_under = 90.0
+show_missing = true
+skip_covered = true
+
 [tool.mypy]
 mypy_path = "src/"
 exclude = "build/"