seecr-testtools 0.4.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,39 @@
1
+ name: Publish to PyPI
2
+
3
+ # Publishes when a MAJOR.MINOR.PATCH tag (e.g. 0.6.4) is pushed. The tag
4
+ # becomes the package version via setuptools_scm.
5
+ on:
6
+ push:
7
+ tags: ["[0-9]+.[0-9]+.[0-9]+"]
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v5
14
+ with:
15
+ fetch-depth: 0
16
+ - uses: actions/setup-python@v6
17
+ with:
18
+ python-version: "3.13"
19
+ - run: pip install build
20
+ - run: python -m build
21
+ - uses: actions/upload-artifact@v4
22
+ with:
23
+ name: dist
24
+ path: dist/
25
+
26
+ publish:
27
+ needs: build
28
+ runs-on: ubuntu-latest
29
+ environment:
30
+ name: pypi
31
+ url: https://pypi.org/project/seecr-testtools/
32
+ permissions:
33
+ id-token: write # PyPI trusted publishing, no API token needed
34
+ steps:
35
+ - uses: actions/download-artifact@v4
36
+ with:
37
+ name: dist
38
+ path: dist/
39
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,22 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
14
+ steps:
15
+ - uses: actions/checkout@v5
16
+ with:
17
+ fetch-depth: 0 # setuptools_scm needs the tags
18
+ - uses: actions/setup-python@v6
19
+ with:
20
+ python-version: ${{ matrix.python-version }}
21
+ - run: pip install -e .
22
+ - run: python -m pytest
@@ -0,0 +1,5 @@
1
+ env/
2
+ *.egg-info/
3
+ dist/
4
+ __pycache__/
5
+ .pytest_cache/
@@ -0,0 +1,29 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Overview
6
+
7
+ `seecr-testtools` is a small Python (>=3.11) library of pytest helpers shared across Seecr projects: `anything` (a wildcard that compares equal to any value, or to values passing a check function), `Mock` (records calls and fakes return values, sync and async), and `login_user` (logs in on a Seecr web-app test client). Runtime dependencies are `pytest` and `pytest-asyncio`; `setuptools_scm` is only a build dependency.
8
+
9
+ ## Commands
10
+
11
+ A virtualenv lives in `env/`.
12
+
13
+ ```sh
14
+ env/bin/python -m pytest # all tests
15
+ env/bin/python -m pytest seecr_testtools/mock_test.py # one file
16
+ env/bin/python -m pytest seecr_testtools/mock_test.py::test_mock # one test
17
+ ```
18
+
19
+ Pytest is configured in `pyproject.toml` under `[tool.pytest]`: pytest-asyncio runs in auto mode, so `async def test_...` needs no marker.
20
+
21
+ ## Conventions
22
+
23
+ - Tests sit next to the module they test as `<module>_test.py`, written as plain pytest functions.
24
+ - Every source file starts with the GPLv3 `## begin license ## ... ## end license ##` header (template data in `doc/license.conf`). Copy it into new files and keep the copyright year(s) current.
25
+ - Versions come from git tags via `setuptools_scm` (tags like `0.4.1`); `seecr_testtools/_version.py` is generated and git-ignored — don't edit it. The package root imports it, so the package must be installed (`pip install -e .`) before tests run.
26
+ - Pushing a version tag to GitHub publishes that version to PyPI (`.github/workflows/publish.yml`), and PyPI never accepts a version twice. Don't push tags unless asked.
27
+ - `anything` and `login_user` are exported from the package root; `Mock` is imported from `seecr_testtools.mock`.
28
+ - `Mock.immitate` is the original misspelling of `Mock.imitate` and is kept as an alias for existing users; use `imitate` in new code.
29
+ - `Mock.imitate(obj)` replaces overridden methods on the real object with `setattr`, so the object's own calls go through the fake. Methods only reached through the real object, not through the mock, are not recorded, and `calls(name)` raises `KeyError` for a method the mock never saw.