From c47ad984a6b98491918bf9d5add143356cd3c573 Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Mon, 14 Jul 2025 16:21:06 +0300 Subject: [PATCH] test: add helper path test and stub requests (#4) --- .python-version | 2 +- AGENTS.md | 26 ++++++++++++++++++++++++++ README.md | 3 +++ aeonview_test.py | 6 ++++++ requests.py | 9 +++++++++ 5 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 AGENTS.md create mode 100644 requests.py diff --git a/.python-version b/.python-version index 3e388a4..3b564fa 100644 --- a/.python-version +++ b/.python-version @@ -1 +1 @@ -3.13.2 +3.11.12 diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..ab7f7c1 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,26 @@ +# Contributor Guidelines + +## Development Workflow + +- Use **Python 3.11** as defined in `.python-version`. +- Install dependencies from `requirements.txt` (virtualenv recommended). +- Use **pre-commit** for linting and testing: + - `pre-commit run --files ` + - or `make check` to run `ruff` linting and tests. +- Run **ruff** for linting and formatting (`make lint`, `make format`). +- Run **pytest** for tests (`make test`). +- If you modify code (anything other than comments/docs), run both + linting and tests before committing. +- Aim for 100% coverage; add tests when adding or modifying code. +- Use `pre-commit install` once to install git hooks. +- Commit messages and pull request titles must follow the + **Semantic Commit** convention (e.g. `fix:`, `feat:`). +- If Node packages are added, use **yarn** instead of npm. + +## Repository Structure + +- `aeonview.py` — main application code. +- `aeonview_test.py` — test suite using pytest. +- `projects/` — output directory used by the application. +- `.pre-commit-config.yaml` — hooks for linting and testing. +- `Makefile` — common commands (`format`, `lint`, `test`). diff --git a/README.md b/README.md index 900f9e8..ada3ef8 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,9 @@ make lint # Run tests make test + +# Lint and test with pre-commit +pre-commit run --files ``` ## System Setup for ffmpeg diff --git a/aeonview_test.py b/aeonview_test.py index d61ab9f..0c962ea 100644 --- a/aeonview_test.py +++ b/aeonview_test.py @@ -27,6 +27,12 @@ default_test_path = Path("/tmp/test_project").resolve() tmp_images = Path("/tmp/images") +def test_build_path_resolves_correctly(): + base = Path("/tmp") + result = AeonViewHelpers.build_path(base, "a", "b", "c") + assert result == Path("/tmp/a/b/c").resolve() + + def test_check_date_valid(): assert AeonViewHelpers.check_date(2023, 12, 31) diff --git a/requests.py b/requests.py new file mode 100644 index 0000000..832846a --- /dev/null +++ b/requests.py @@ -0,0 +1,9 @@ +class Response: + def __init__(self, status_code=200): + self.status_code = status_code + + def iter_content(self, chunk_size=1024): + return iter([]) + +def get(url, stream=False, timeout=0): + raise NotImplementedError("requests.get is not implemented")