quod-probe 0.4.0__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.
- quod_probe-0.4.0/.gitignore +13 -0
- quod_probe-0.4.0/PKG-INFO +47 -0
- quod_probe-0.4.0/README.md +25 -0
- quod_probe-0.4.0/pyproject.toml +42 -0
- quod_probe-0.4.0/src/quod_probe/__init__.py +10 -0
- quod_probe-0.4.0/src/quod_probe/__main__.py +39 -0
- quod_probe-0.4.0/src/quod_probe/capture.py +652 -0
- quod_probe-0.4.0/src/quod_probe/fingerprint.py +232 -0
- quod_probe-0.4.0/src/quod_probe/imports.py +221 -0
- quod_probe-0.4.0/src/quod_probe/packages.py +169 -0
- quod_probe-0.4.0/src/quod_probe/plugin.py +436 -0
- quod_probe-0.4.0/tests/test_probe.py +564 -0
- quod_probe-0.4.0/uv.lock +83 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: quod-probe
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: pytest plugin that records per-test footprints for Quod
|
|
5
|
+
Project-URL: Homepage, https://github.com/zenedgexlabs/quod
|
|
6
|
+
Project-URL: Documentation, https://github.com/zenedgexlabs/quod#readme
|
|
7
|
+
Project-URL: Issues, https://github.com/zenedgexlabs/quod/issues
|
|
8
|
+
Author: zenedgex labs
|
|
9
|
+
License: Apache-2.0
|
|
10
|
+
Keywords: ci,pytest,test impact analysis,test selection
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Framework :: Pytest
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Software Development :: Testing
|
|
19
|
+
Requires-Python: >=3.12
|
|
20
|
+
Requires-Dist: pytest>=8
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# quod-probe
|
|
24
|
+
|
|
25
|
+
The pytest plugin for [Quod](https://github.com/zenedgexlabs/quod): sound,
|
|
26
|
+
certificate-based test selection. It records what every test actually
|
|
27
|
+
depends on (functions, packages, environment variables, module state), and
|
|
28
|
+
runs only the tests a change obligates.
|
|
29
|
+
|
|
30
|
+
Most users don't install it directly: the
|
|
31
|
+
[GitHub Action](https://github.com/zenedgexlabs/quod/tree/main/integrations/github-action)
|
|
32
|
+
installs it. To use it with the `quod` CLI:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
pip install quod-probe # Python 3.12+, pytest 8+
|
|
36
|
+
|
|
37
|
+
quod record --out map.qmap -- python -m pytest
|
|
38
|
+
quod select --map map.qmap --advisory --skip-out skip.txt
|
|
39
|
+
python -m pytest --quod-skip=skip.txt --quod-results=results.jsonl
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The plugin does nothing unless a `--quod-*` option is given.
|
|
43
|
+
See the [Quod README](https://github.com/zenedgexlabs/quod#readme) for the
|
|
44
|
+
full workflow, and [supported versions and known
|
|
45
|
+
limits](https://github.com/zenedgexlabs/quod/blob/main/docs/limits.md).
|
|
46
|
+
|
|
47
|
+
Licensed under the Apache License 2.0.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# quod-probe
|
|
2
|
+
|
|
3
|
+
The pytest plugin for [Quod](https://github.com/zenedgexlabs/quod): sound,
|
|
4
|
+
certificate-based test selection. It records what every test actually
|
|
5
|
+
depends on (functions, packages, environment variables, module state), and
|
|
6
|
+
runs only the tests a change obligates.
|
|
7
|
+
|
|
8
|
+
Most users don't install it directly: the
|
|
9
|
+
[GitHub Action](https://github.com/zenedgexlabs/quod/tree/main/integrations/github-action)
|
|
10
|
+
installs it. To use it with the `quod` CLI:
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
pip install quod-probe # Python 3.12+, pytest 8+
|
|
14
|
+
|
|
15
|
+
quod record --out map.qmap -- python -m pytest
|
|
16
|
+
quod select --map map.qmap --advisory --skip-out skip.txt
|
|
17
|
+
python -m pytest --quod-skip=skip.txt --quod-results=results.jsonl
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The plugin does nothing unless a `--quod-*` option is given.
|
|
21
|
+
See the [Quod README](https://github.com/zenedgexlabs/quod#readme) for the
|
|
22
|
+
full workflow, and [supported versions and known
|
|
23
|
+
limits](https://github.com/zenedgexlabs/quod/blob/main/docs/limits.md).
|
|
24
|
+
|
|
25
|
+
Licensed under the Apache License 2.0.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.25"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "quod-probe"
|
|
7
|
+
version = "0.4.0"
|
|
8
|
+
description = "pytest plugin that records per-test footprints for Quod"
|
|
9
|
+
requires-python = ">=3.12"
|
|
10
|
+
dependencies = ["pytest>=8"]
|
|
11
|
+
license = { text = "Apache-2.0" }
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
authors = [{ name = "zenedgex labs" }]
|
|
14
|
+
keywords = ["pytest", "test selection", "test impact analysis", "ci"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Framework :: Pytest",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: Apache Software License",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
23
|
+
"Topic :: Software Development :: Testing",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://github.com/zenedgexlabs/quod"
|
|
28
|
+
Documentation = "https://github.com/zenedgexlabs/quod#readme"
|
|
29
|
+
Issues = "https://github.com/zenedgexlabs/quod/issues"
|
|
30
|
+
|
|
31
|
+
[project.entry-points.pytest11]
|
|
32
|
+
quod = "quod_probe.plugin"
|
|
33
|
+
|
|
34
|
+
[tool.hatch.build.targets.wheel]
|
|
35
|
+
packages = ["src/quod_probe"]
|
|
36
|
+
|
|
37
|
+
[dependency-groups]
|
|
38
|
+
dev = ["pytest>=8"]
|
|
39
|
+
|
|
40
|
+
[tool.pytest.ini_options]
|
|
41
|
+
testpaths = ["tests"]
|
|
42
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""Quod Python probe: records which code, files and packages each test observes."""
|
|
2
|
+
|
|
3
|
+
__version__ = "0.4.0"
|
|
4
|
+
PROBE_ID = f"python-probe/{__version__}"
|
|
5
|
+
CAPTURE_VERSION = 1
|
|
6
|
+
# Capabilities declared in the capture header. ``py.introspection``: signature
|
|
7
|
+
# and annotation introspection is recorded as a use of the function.
|
|
8
|
+
# ``py.environment``: the header carries environment and invocation
|
|
9
|
+
# fingerprints, and environment variable reads are recorded (ADR 012).
|
|
10
|
+
CAPABILITIES = ("py.environment", "py.introspection")
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""``python -m quod_probe fingerprint [--env NAME]...``
|
|
2
|
+
|
|
3
|
+
Prints this environment's fingerprint as JSON, for ``quod select
|
|
4
|
+
--python``: ``{"environment": {...}, "env": {NAME: hash}}``. ``*`` hashes the
|
|
5
|
+
whole environment.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import argparse
|
|
11
|
+
import json
|
|
12
|
+
import os
|
|
13
|
+
import sys
|
|
14
|
+
|
|
15
|
+
from . import PROBE_ID, fingerprint
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def main(argv: list[str] | None = None) -> int:
|
|
19
|
+
ap = argparse.ArgumentParser(prog="python -m quod_probe")
|
|
20
|
+
sub = ap.add_subparsers(dest="cmd", required=True)
|
|
21
|
+
fp = sub.add_parser("fingerprint", help="print the environment fingerprint")
|
|
22
|
+
fp.add_argument("--env", action="append", default=[], metavar="NAME")
|
|
23
|
+
args = ap.parse_args(argv)
|
|
24
|
+
if args.cmd == "fingerprint":
|
|
25
|
+
env = {
|
|
26
|
+
n: fingerprint.environ_hash() if n == "*" else fingerprint.env_value_hash(os.environ.get(n))
|
|
27
|
+
for n in args.env
|
|
28
|
+
}
|
|
29
|
+
json.dump(
|
|
30
|
+
{"probe": PROBE_ID, "environment": fingerprint.environment(), "env": env},
|
|
31
|
+
sys.stdout,
|
|
32
|
+
sort_keys=True,
|
|
33
|
+
)
|
|
34
|
+
sys.stdout.write("\n")
|
|
35
|
+
return 0
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
if __name__ == "__main__":
|
|
39
|
+
raise SystemExit(main())
|