From c95bea879d9d89bd0353287b0dd8b325f838848e Mon Sep 17 00:00:00 2001 From: josh Date: Wed, 22 Apr 2026 22:53:22 -0400 Subject: [PATCH] feat: enforce 85% test coverage in CI and fix cross-platform strftime bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add pyproject.toml with pytest-cov config so CI fails if coverage drops below 85%. Fix series_view _format_start using Linux-only %-I/%-d codes that crash on Windows — use manual formatting instead. Co-Authored-By: Claude Opus 4.6 --- .gitea/workflows/ci.yml | 2 +- .gitignore | 1 + app/series_view.py | 5 ++++- pyproject.toml | 15 +++++++++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 pyproject.toml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 2b78ff4..8c28e0b 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -45,7 +45,7 @@ jobs: run: pip install -r requirements-dev.txt - name: Run tests - run: pytest tests/ -v + run: pytest --cov --cov-report=term-missing build-push: name: Build & Push diff --git a/.gitignore b/.gitignore index e7706b5..4e8fe94 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,6 @@ nhl_standings.db **/__pycache__ .venv/ .coverage +htmlcov/ .pytest_cache/ .claude/ diff --git a/app/series_view.py b/app/series_view.py index 319814f..ed0a575 100644 --- a/app/series_view.py +++ b/app/series_view.py @@ -165,7 +165,10 @@ def _format_start(start_utc): ) except ValueError: return "", "" - return dt.strftime("%-I:%M %p ET"), dt.strftime("%a %b %-d") + hour = dt.strftime("%I").lstrip("0") or "12" + time_str = f"{hour}:{dt.strftime('%M %p')} ET" + date_str = f"{dt.strftime('%a %b')} {dt.day}" + return time_str, date_str def _to_int(value, default=0): diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..ba5934e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,15 @@ +[tool.pytest.ini_options] +testpaths = ["tests"] +addopts = "-v --tb=short" + +[tool.coverage.run] +source = ["app"] + +[tool.coverage.report] +fail_under = 85 +show_missing = true +skip_empty = true +exclude_lines = [ + "pragma: no cover", + "if __name__ == .__main__.", +]