Skip to content

Commit 1882073

Browse files
authored
chore: replace pytest-cov by coverage (#374)
1 parent fea96df commit 1882073

File tree

4 files changed

+339
-149
lines changed

4 files changed

+339
-149
lines changed

pyproject.toml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ dependencies = ["typing_extensions"]
2727

2828
[dependency-groups]
2929
dev = [
30-
"pytest",
31-
"pytest-cov",
30+
"pytest>=8.0.0",
31+
"coverage",
3232
"ruff",
3333
"starlette",
34-
"quart",
34+
"quart>=0.20.0",
3535
"hypercorn>=0.15.0",
3636
"mypy",
3737
"brotli",
38-
"brotli-asgi",
38+
"brotli-asgi>=1.6.0",
3939
"mkautodoc",
4040
"mkdocs>=1.6.0; python_version >= '3.12'",
4141
"mkdocs-material; python_version >= '3.12'",
@@ -66,10 +66,6 @@ ignore = ["UP031"] # https://docs.astral.sh/ruff/rules/printf-string-formatting/
6666
strict = true
6767

6868
[tool.pytest.ini_options]
69-
log_cli = true
70-
log_cli_level = "INFO"
71-
log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
72-
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
7369
addopts = "-rXs --strict-config --strict-markers"
7470
xfail_strict = true
7571
filterwarnings = [
@@ -88,6 +84,9 @@ filterwarnings = [
8884
source_pkgs = ["mangum", "tests"]
8985

9086
[tool.coverage.report]
87+
fail_under = 100
88+
skip_covered = true
89+
show_missing = true
9190
exclude_lines = [
9291
"pragma: no cover",
9392
"pragma: nocover",

scripts/test

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
set -x # print executed commands to the terminal
44

5-
uv run pytest --ignore venv --cov=mangum --cov=tests --cov-fail-under=100 --cov-report=term-missing "${@}"
5+
uv run coverage run -m pytest "${@}"
6+
uv run coverage report

tests/test_http.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import base64
44
import gzip
55
import json
6+
import logging
67

78
import brotli
89
import pytest
@@ -583,6 +584,8 @@ async def app(scope, receive, send):
583584

584585
@pytest.mark.parametrize("mock_aws_api_gateway_event", [["GET", b"", None]], indirect=True)
585586
def test_http_logging(mock_aws_api_gateway_event, caplog: pytest.LogCaptureFixture) -> None:
587+
caplog.set_level(logging.INFO)
588+
586589
async def app(scope, receive, send):
587590
assert scope["type"] == "http"
588591
await send(

0 commit comments

Comments
 (0)