pytest-telescope 0.1.0a1__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.
Files changed (47) hide show
  1. pytest_telescope-0.1.0a1/.gitignore +10 -0
  2. pytest_telescope-0.1.0a1/.readthedocs.yaml +11 -0
  3. pytest_telescope-0.1.0a1/CONTRIBUTING.md +11 -0
  4. pytest_telescope-0.1.0a1/LICENSE +21 -0
  5. pytest_telescope-0.1.0a1/PKG-INFO +122 -0
  6. pytest_telescope-0.1.0a1/README.md +101 -0
  7. pytest_telescope-0.1.0a1/benchmarks/results/linux-docker.json +1226 -0
  8. pytest_telescope-0.1.0a1/benchmarks/run.py +261 -0
  9. pytest_telescope-0.1.0a1/benchmarks/test_run.py +102 -0
  10. pytest_telescope-0.1.0a1/docs/benchmark.md +120 -0
  11. pytest_telescope-0.1.0a1/docs/development.md +48 -0
  12. pytest_telescope-0.1.0a1/docs/execution-contract.md +276 -0
  13. pytest_telescope-0.1.0a1/docs/index.md +22 -0
  14. pytest_telescope-0.1.0a1/docs/publishing.md +61 -0
  15. pytest_telescope-0.1.0a1/docs/requirements.txt +1 -0
  16. pytest_telescope-0.1.0a1/docs/specification.md +12 -0
  17. pytest_telescope-0.1.0a1/examples/analytics/README.md +25 -0
  18. pytest_telescope-0.1.0a1/examples/analytics/data/customers.json +1 -0
  19. pytest_telescope-0.1.0a1/examples/analytics/data/demand.json +1 -0
  20. pytest_telescope-0.1.0a1/examples/analytics/data/prices.json +1 -0
  21. pytest_telescope-0.1.0a1/examples/analytics/demoapp/__init__.py +1 -0
  22. pytest_telescope-0.1.0a1/examples/analytics/demoapp/common.py +7 -0
  23. pytest_telescope-0.1.0a1/examples/analytics/demoapp/demand.py +12 -0
  24. pytest_telescope-0.1.0a1/examples/analytics/demoapp/pricing.py +12 -0
  25. pytest_telescope-0.1.0a1/examples/analytics/demoapp/scoring.py +12 -0
  26. pytest_telescope-0.1.0a1/examples/analytics/pyproject.toml +25 -0
  27. pytest_telescope-0.1.0a1/examples/analytics/tests/conftest.py +8 -0
  28. pytest_telescope-0.1.0a1/examples/analytics/tests/test_demand.py +13 -0
  29. pytest_telescope-0.1.0a1/examples/analytics/tests/test_pricing.py +13 -0
  30. pytest_telescope-0.1.0a1/examples/analytics/tests/test_scoring.py +13 -0
  31. pytest_telescope-0.1.0a1/mkdocs.yml +11 -0
  32. pytest_telescope-0.1.0a1/pyproject.toml +55 -0
  33. pytest_telescope-0.1.0a1/scripts/check.py +36 -0
  34. pytest_telescope-0.1.0a1/src/pytest_telescope/__init__.py +4 -0
  35. pytest_telescope-0.1.0a1/src/pytest_telescope/__main__.py +3 -0
  36. pytest_telescope-0.1.0a1/src/pytest_telescope/controller.py +466 -0
  37. pytest_telescope-0.1.0a1/src/pytest_telescope/model.py +451 -0
  38. pytest_telescope-0.1.0a1/src/pytest_telescope/plan.py +28 -0
  39. pytest_telescope-0.1.0a1/src/pytest_telescope/plugin.py +49 -0
  40. pytest_telescope-0.1.0a1/src/pytest_telescope/result.py +101 -0
  41. pytest_telescope-0.1.0a1/src/pytest_telescope/runtime.py +665 -0
  42. pytest_telescope-0.1.0a1/src/pytest_telescope/worker.py +115 -0
  43. pytest_telescope-0.1.0a1/tests/test_cache_contract.py +165 -0
  44. pytest_telescope-0.1.0a1/tests/test_execution.py +224 -0
  45. pytest_telescope-0.1.0a1/tests/test_model_contract.py +110 -0
  46. pytest_telescope-0.1.0a1/tests/test_plugin.py +222 -0
  47. pytest_telescope-0.1.0a1/tests/test_runtime_contract.py +525 -0
@@ -0,0 +1,10 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .pytest_cache/
4
+ .ruff_cache/
5
+ .venv/
6
+ build/
7
+ dist/
8
+ site/
9
+ *.egg-info/
10
+ .pytest-telescope/
@@ -0,0 +1,11 @@
1
+ version: 2
2
+ build:
3
+ os: ubuntu-24.04
4
+ tools:
5
+ python: "3.12"
6
+ mkdocs:
7
+ configuration: mkdocs.yml
8
+ fail_on_warning: true
9
+ python:
10
+ install:
11
+ - requirements: docs/requirements.txt
@@ -0,0 +1,11 @@
1
+ # Contributing
2
+
3
+ See [development](docs/development.md) for installation and checks, and the
4
+ [execution contract](docs/specification.md) for the complete first release.
5
+
6
+ Add behavioral regression tests and relevant documentation together. Real worker
7
+ integration tests must establish isolation before it is claimed; skipped sandbox
8
+ tests are not a qualifying result. Keep the synthetic benchmark reproducible and
9
+ publish observed measurements, including overhead and unfavorable results.
10
+
11
+ Contributions are licensed under the project's MIT License.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 xu-hao
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,122 @@
1
+ Metadata-Version: 2.4
2
+ Name: pytest-telescope
3
+ Version: 0.1.0a1
4
+ Summary: Declared inputs. Isolated tests. Focused reruns.
5
+ Project-URL: Repository, https://github.com/xu-hao/pytest-telescope
6
+ Project-URL: Issues, https://github.com/xu-hao/pytest-telescope/issues
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 2 - Pre-Alpha
10
+ Classifier: Framework :: Pytest
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Topic :: Software Development :: Testing
13
+ Requires-Python: >=3.11
14
+ Requires-Dist: pytest<10,>=8.3
15
+ Provides-Extra: dev
16
+ Requires-Dist: build<2,>=1.2; extra == 'dev'
17
+ Requires-Dist: mkdocs==1.6.1; extra == 'dev'
18
+ Requires-Dist: ruff<1,>=0.9; extra == 'dev'
19
+ Requires-Dist: twine<7,>=6; extra == 'dev'
20
+ Description-Content-Type: text/markdown
21
+
22
+ # pytest-telescope
23
+
24
+ Declared inputs. Isolated tests. Focused reruns.
25
+
26
+ pytest-telescope uses one manifest to define which project files a test target can read
27
+ and which changes invalidate its previous successful result. Each target is a fresh
28
+ pytest session inside a Linux Docker container. Successful unchanged targets can reuse
29
+ their recorded results; reused cases are reported separately from executed cases.
30
+
31
+ **Alpha (0.1.0a1):** implemented and qualified on Linux with real Docker workers. The
32
+ [benchmark](https://github.com/xu-hao/pytest-telescope/blob/main/docs/benchmark.md)
33
+ records measured cold, warm, and selective reruns, including their overhead. The
34
+ supported boundary and reuse assumptions are explicit; arbitrary Python determinism is
35
+ not guaranteed.
36
+
37
+ ## Quickstart
38
+
39
+ Requirements: Linux, Python 3.11+, and a working local Docker daemon exposed through a
40
+ Unix socket, with permission to build and run Linux containers. Runtime preparation
41
+ needs network access; test workers have no network. Install from this checkout in a
42
+ virtual environment:
43
+
44
+ ```sh
45
+ python -m venv .venv
46
+ . .venv/bin/activate
47
+ python -m pip install .
48
+ ```
49
+
50
+ From your project's root, add a manifest to `pyproject.toml`:
51
+
52
+ ```toml
53
+ [tool.pytest.ini_options]
54
+ pythonpath = ["."]
55
+
56
+ [tool.pytest_telescope]
57
+ test_roots = ["tests"]
58
+
59
+ [tool.pytest_telescope.bundles.common]
60
+ inputs = ["tests/conftest.py", "app/__init__.py"]
61
+
62
+ [tool.pytest_telescope.targets.parser]
63
+ tests = ["tests/test_parser.py"]
64
+ inputs = ["app/parser.py", "tests/data/input.json"]
65
+ bundles = ["common"]
66
+ ```
67
+
68
+ Declare every fixture, helper, application module, and resource your target needs. Then
69
+ prepare a clean runtime and execute:
70
+
71
+ ```sh
72
+ python -m pytest_telescope runtime
73
+ python -m pytest_telescope plan
74
+ python -m pytest_telescope run --explain -- -q
75
+ python -m pytest_telescope run --explain -- -q
76
+ ```
77
+
78
+ The second identical run can reuse complete successful targets. A missing input is an
79
+ error, not permission to expose more of your checkout. See the
80
+ [specification](https://github.com/xu-hao/pytest-telescope/blob/main/docs/specification.md)
81
+ for declarations, grouping, invalidation, limits, and troubleshooting, and the
82
+ [synthetic
83
+ example](https://github.com/xu-hao/pytest-telescope/blob/main/examples/analytics/README.md)
84
+ for an executable three-target project.
85
+
86
+ ```sh
87
+ python -m pytest_telescope run --force -- -q
88
+ python -m pytest_telescope run --no-cache -- -q
89
+ python -m pytest_telescope run --timeout 120 -- -k parser
90
+ ```
91
+
92
+ `--force` executes even when a successful record exists. `--no-cache` disables reuse and
93
+ recording. For permanently non-cacheable targets, set `cache = false`. Clocks,
94
+ randomness, environment, native state, and external services can invalidate assumptions
95
+ about reuse: filesystem isolation does not prove arbitrary Python programs
96
+ deterministic.
97
+
98
+ ## Runtime and pytest integration
99
+
100
+ The runtime contains a pinned Python base image and wheel-installed dependencies, not
101
+ your host virtual environment or an editable copy of your application. For additional
102
+ third-party packages, pass a requirements file containing the complete transitive
103
+ dependency closure as exact `name==version` wheel dependencies:
104
+
105
+ ```sh
106
+ python -m pytest_telescope runtime --requirements requirements.txt
107
+ ```
108
+
109
+ The dedicated CLI starts no host pytest session. `pytest --telescope` also routes to
110
+ isolated workers, but other installed plugins may execute during host pytest startup.
111
+ `pytest --telescope-plan` remains available for static planning. Ordinary pytest stays
112
+ ordinary when telescope mode is disabled; use `-p no:telescope` to disable plugin
113
+ loading entirely.
114
+
115
+ See
116
+ [development](https://github.com/xu-hao/pytest-telescope/blob/main/docs/development.md),
117
+ [benchmark
118
+ methodology](https://github.com/xu-hao/pytest-telescope/blob/main/docs/benchmark.md),
119
+ and
120
+ [publishing](https://github.com/xu-hao/pytest-telescope/blob/main/docs/publishing.md).
121
+ Licensed under the [MIT
122
+ License](https://github.com/xu-hao/pytest-telescope/blob/main/LICENSE).
@@ -0,0 +1,101 @@
1
+ # pytest-telescope
2
+
3
+ Declared inputs. Isolated tests. Focused reruns.
4
+
5
+ pytest-telescope uses one manifest to define which project files a test target can read
6
+ and which changes invalidate its previous successful result. Each target is a fresh
7
+ pytest session inside a Linux Docker container. Successful unchanged targets can reuse
8
+ their recorded results; reused cases are reported separately from executed cases.
9
+
10
+ **Alpha (0.1.0a1):** implemented and qualified on Linux with real Docker workers. The
11
+ [benchmark](https://github.com/xu-hao/pytest-telescope/blob/main/docs/benchmark.md)
12
+ records measured cold, warm, and selective reruns, including their overhead. The
13
+ supported boundary and reuse assumptions are explicit; arbitrary Python determinism is
14
+ not guaranteed.
15
+
16
+ ## Quickstart
17
+
18
+ Requirements: Linux, Python 3.11+, and a working local Docker daemon exposed through a
19
+ Unix socket, with permission to build and run Linux containers. Runtime preparation
20
+ needs network access; test workers have no network. Install from this checkout in a
21
+ virtual environment:
22
+
23
+ ```sh
24
+ python -m venv .venv
25
+ . .venv/bin/activate
26
+ python -m pip install .
27
+ ```
28
+
29
+ From your project's root, add a manifest to `pyproject.toml`:
30
+
31
+ ```toml
32
+ [tool.pytest.ini_options]
33
+ pythonpath = ["."]
34
+
35
+ [tool.pytest_telescope]
36
+ test_roots = ["tests"]
37
+
38
+ [tool.pytest_telescope.bundles.common]
39
+ inputs = ["tests/conftest.py", "app/__init__.py"]
40
+
41
+ [tool.pytest_telescope.targets.parser]
42
+ tests = ["tests/test_parser.py"]
43
+ inputs = ["app/parser.py", "tests/data/input.json"]
44
+ bundles = ["common"]
45
+ ```
46
+
47
+ Declare every fixture, helper, application module, and resource your target needs. Then
48
+ prepare a clean runtime and execute:
49
+
50
+ ```sh
51
+ python -m pytest_telescope runtime
52
+ python -m pytest_telescope plan
53
+ python -m pytest_telescope run --explain -- -q
54
+ python -m pytest_telescope run --explain -- -q
55
+ ```
56
+
57
+ The second identical run can reuse complete successful targets. A missing input is an
58
+ error, not permission to expose more of your checkout. See the
59
+ [specification](https://github.com/xu-hao/pytest-telescope/blob/main/docs/specification.md)
60
+ for declarations, grouping, invalidation, limits, and troubleshooting, and the
61
+ [synthetic
62
+ example](https://github.com/xu-hao/pytest-telescope/blob/main/examples/analytics/README.md)
63
+ for an executable three-target project.
64
+
65
+ ```sh
66
+ python -m pytest_telescope run --force -- -q
67
+ python -m pytest_telescope run --no-cache -- -q
68
+ python -m pytest_telescope run --timeout 120 -- -k parser
69
+ ```
70
+
71
+ `--force` executes even when a successful record exists. `--no-cache` disables reuse and
72
+ recording. For permanently non-cacheable targets, set `cache = false`. Clocks,
73
+ randomness, environment, native state, and external services can invalidate assumptions
74
+ about reuse: filesystem isolation does not prove arbitrary Python programs
75
+ deterministic.
76
+
77
+ ## Runtime and pytest integration
78
+
79
+ The runtime contains a pinned Python base image and wheel-installed dependencies, not
80
+ your host virtual environment or an editable copy of your application. For additional
81
+ third-party packages, pass a requirements file containing the complete transitive
82
+ dependency closure as exact `name==version` wheel dependencies:
83
+
84
+ ```sh
85
+ python -m pytest_telescope runtime --requirements requirements.txt
86
+ ```
87
+
88
+ The dedicated CLI starts no host pytest session. `pytest --telescope` also routes to
89
+ isolated workers, but other installed plugins may execute during host pytest startup.
90
+ `pytest --telescope-plan` remains available for static planning. Ordinary pytest stays
91
+ ordinary when telescope mode is disabled; use `-p no:telescope` to disable plugin
92
+ loading entirely.
93
+
94
+ See
95
+ [development](https://github.com/xu-hao/pytest-telescope/blob/main/docs/development.md),
96
+ [benchmark
97
+ methodology](https://github.com/xu-hao/pytest-telescope/blob/main/docs/benchmark.md),
98
+ and
99
+ [publishing](https://github.com/xu-hao/pytest-telescope/blob/main/docs/publishing.md).
100
+ Licensed under the [MIT
101
+ License](https://github.com/xu-hao/pytest-telescope/blob/main/LICENSE).