pytest-httpchain 0.6.0__tar.gz → 0.8.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.
- {pytest_httpchain-0.6.0 → pytest_httpchain-0.8.0}/PKG-INFO +23 -7
- {pytest_httpchain-0.6.0 → pytest_httpchain-0.8.0}/README.md +13 -3
- {pytest_httpchain-0.6.0 → pytest_httpchain-0.8.0}/pyproject.toml +10 -15
- {pytest_httpchain-0.6.0 → pytest_httpchain-0.8.0}/src/pytest_httpchain/__init__.py +7 -0
- {pytest_httpchain-0.6.0 → pytest_httpchain-0.8.0}/src/pytest_httpchain/carrier.py +221 -116
- {pytest_httpchain-0.6.0 → pytest_httpchain-0.8.0}/src/pytest_httpchain/cli.py +49 -44
- {pytest_httpchain-0.6.0 → pytest_httpchain-0.8.0}/src/pytest_httpchain/constants.py +3 -2
- {pytest_httpchain-0.6.0 → pytest_httpchain-0.8.0}/src/pytest_httpchain/dataflow.py +8 -24
- {pytest_httpchain-0.6.0 → pytest_httpchain-0.8.0}/src/pytest_httpchain/har_writer.py +23 -4
- {pytest_httpchain-0.6.0 → pytest_httpchain-0.8.0}/src/pytest_httpchain/plugin.py +82 -36
- pytest_httpchain-0.8.0/src/pytest_httpchain/report_formatter.py +88 -0
- {pytest_httpchain-0.6.0 → pytest_httpchain-0.8.0}/src/pytest_httpchain/schema.py +13 -7
- {pytest_httpchain-0.6.0 → pytest_httpchain-0.8.0}/src/pytest_httpchain/utils.py +38 -0
- {pytest_httpchain-0.6.0 → pytest_httpchain-0.8.0}/src/pytest_httpchain/validation.py +240 -93
- pytest_httpchain-0.6.0/src/pytest_httpchain/report_formatter.py +0 -69
- {pytest_httpchain-0.6.0 → pytest_httpchain-0.8.0}/LICENSE +0 -0
- {pytest_httpchain-0.6.0 → pytest_httpchain-0.8.0}/src/pytest_httpchain/exceptions.py +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pytest-httpchain
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Summary: pytest plugin for HTTP testing using JSON files
|
|
5
|
-
Keywords: testing,pytest,
|
|
5
|
+
Keywords: testing,pytest,httpx,http,api,integration-testing
|
|
6
6
|
Author: Alexander Eresov
|
|
7
7
|
Author-email: Alexander Eresov <aeresov@gmail.com>
|
|
8
8
|
License-Expression: MIT
|
|
@@ -15,14 +15,20 @@ Classifier: Programming Language :: Python :: 3
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.13
|
|
16
16
|
Classifier: Topic :: Software Development :: Testing
|
|
17
17
|
Requires-Dist: httpx[http2]>=0.27.0
|
|
18
|
+
Requires-Dist: jmespath>=1.0.0
|
|
19
|
+
Requires-Dist: jsonschema>=4.0.0
|
|
18
20
|
Requires-Dist: pydantic>=2.11.7
|
|
19
|
-
Requires-Dist: pyrate-limiter>=
|
|
21
|
+
Requires-Dist: pyrate-limiter>=4.0.0
|
|
22
|
+
Requires-Dist: pytest>=8.4
|
|
23
|
+
Requires-Dist: pytest-httpchain-core
|
|
20
24
|
Requires-Dist: pytest-httpchain-jsonref
|
|
21
25
|
Requires-Dist: pytest-httpchain-models
|
|
22
26
|
Requires-Dist: pytest-httpchain-templates
|
|
27
|
+
Requires-Dist: pytest-httpchain-userfunc
|
|
23
28
|
Requires-Dist: pytest-order>=1.3.0
|
|
29
|
+
Requires-Dist: simpleeval>=1.0.3
|
|
24
30
|
Requires-Dist: typer>=0.16.0
|
|
25
|
-
Requires-Python: >=3.13
|
|
31
|
+
Requires-Python: >=3.13
|
|
26
32
|
Description-Content-Type: text/markdown
|
|
27
33
|
|
|
28
34
|
[](https://pypi.python.org/pypi/pytest-httpchain)
|
|
@@ -71,7 +77,7 @@ A key-value store persists throughout scenario execution. Variables, fixtures, a
|
|
|
71
77
|
|
|
72
78
|
- **JMESPath** — Extract values from JSON responses directly
|
|
73
79
|
- **JSON Schema** — Validate response structure against a schema
|
|
74
|
-
- **User functions** — Call Python functions for custom extraction, verification, or [authentication](https://
|
|
80
|
+
- **User functions** — Call Python functions for custom extraction, verification, or [authentication](https://www.python-httpx.org/advanced/authentication/#custom-authentication-schemes)
|
|
75
81
|
|
|
76
82
|
### Full pytest integration
|
|
77
83
|
|
|
@@ -191,11 +197,21 @@ pip install 'git+https://github.com/aeresov/pytest-httpchain@main'
|
|
|
191
197
|
|
|
192
198
|
- Test file discovery is based on this name pattern: `test_<name>.<suffix>.json`.
|
|
193
199
|
The `suffix` is configurable as pytest ini option, default value is **http**.
|
|
194
|
-
- `$ref` instructions can point to other files
|
|
200
|
+
- `$ref` instructions can point to other files using relative paths; absolute paths are rejected for security.
|
|
195
201
|
You can limit the depth of relative path traversal using `ref_parent_traversal_depth` ini option, default value is **3**.
|
|
196
202
|
- Template expressions support list/dict comprehensions. You can limit the maximum comprehension length using `max_comprehension_length` ini option, default value is **50000**.
|
|
197
203
|
- Parallel stage iterations (repeat/foreach) have a safety limit configurable via `max_parallel_iterations` ini option, default value is **10000**.
|
|
198
204
|
|
|
205
|
+
### HAR export
|
|
206
|
+
|
|
207
|
+
Pass `--output-dir DIR` on the pytest command line to write an [HAR](http://www.softwareishard.com/blog/har-12-spec/) file (and a "HAR File" report section) capturing each test's HTTP traffic:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
pytest --output-dir ./har-output
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
HAR files contain full requests/responses **including credential headers and saved tokens** — nothing is redacted, so scrub them before sharing. See the [HAR export docs](https://aeresov.github.io/pytest-httpchain/getting-started/#har-export).
|
|
214
|
+
|
|
199
215
|
## AI agent support
|
|
200
216
|
|
|
201
217
|
`pytest-httpchain` ships a scenario validator to help AI coding agents (and humans) author and check test scenarios.
|
|
@@ -235,7 +251,7 @@ A JSON Schema is published for as-you-type validation and autocomplete. Referenc
|
|
|
235
251
|
The hosted schema tracks the latest release; to pin the schema matching your installed version (e.g. for CI), emit it locally:
|
|
236
252
|
|
|
237
253
|
```bash
|
|
238
|
-
uvx pytest-httpchain schema
|
|
254
|
+
uvx pytest-httpchain schema > scenario.schema.json
|
|
239
255
|
```
|
|
240
256
|
|
|
241
257
|
### Inspecting scenarios
|
|
@@ -44,7 +44,7 @@ A key-value store persists throughout scenario execution. Variables, fixtures, a
|
|
|
44
44
|
|
|
45
45
|
- **JMESPath** — Extract values from JSON responses directly
|
|
46
46
|
- **JSON Schema** — Validate response structure against a schema
|
|
47
|
-
- **User functions** — Call Python functions for custom extraction, verification, or [authentication](https://
|
|
47
|
+
- **User functions** — Call Python functions for custom extraction, verification, or [authentication](https://www.python-httpx.org/advanced/authentication/#custom-authentication-schemes)
|
|
48
48
|
|
|
49
49
|
### Full pytest integration
|
|
50
50
|
|
|
@@ -164,11 +164,21 @@ pip install 'git+https://github.com/aeresov/pytest-httpchain@main'
|
|
|
164
164
|
|
|
165
165
|
- Test file discovery is based on this name pattern: `test_<name>.<suffix>.json`.
|
|
166
166
|
The `suffix` is configurable as pytest ini option, default value is **http**.
|
|
167
|
-
- `$ref` instructions can point to other files
|
|
167
|
+
- `$ref` instructions can point to other files using relative paths; absolute paths are rejected for security.
|
|
168
168
|
You can limit the depth of relative path traversal using `ref_parent_traversal_depth` ini option, default value is **3**.
|
|
169
169
|
- Template expressions support list/dict comprehensions. You can limit the maximum comprehension length using `max_comprehension_length` ini option, default value is **50000**.
|
|
170
170
|
- Parallel stage iterations (repeat/foreach) have a safety limit configurable via `max_parallel_iterations` ini option, default value is **10000**.
|
|
171
171
|
|
|
172
|
+
### HAR export
|
|
173
|
+
|
|
174
|
+
Pass `--output-dir DIR` on the pytest command line to write an [HAR](http://www.softwareishard.com/blog/har-12-spec/) file (and a "HAR File" report section) capturing each test's HTTP traffic:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
pytest --output-dir ./har-output
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
HAR files contain full requests/responses **including credential headers and saved tokens** — nothing is redacted, so scrub them before sharing. See the [HAR export docs](https://aeresov.github.io/pytest-httpchain/getting-started/#har-export).
|
|
181
|
+
|
|
172
182
|
## AI agent support
|
|
173
183
|
|
|
174
184
|
`pytest-httpchain` ships a scenario validator to help AI coding agents (and humans) author and check test scenarios.
|
|
@@ -208,7 +218,7 @@ A JSON Schema is published for as-you-type validation and autocomplete. Referenc
|
|
|
208
218
|
The hosted schema tracks the latest release; to pin the schema matching your installed version (e.g. for CI), emit it locally:
|
|
209
219
|
|
|
210
220
|
```bash
|
|
211
|
-
uvx pytest-httpchain schema
|
|
221
|
+
uvx pytest-httpchain schema > scenario.schema.json
|
|
212
222
|
```
|
|
213
223
|
|
|
214
224
|
### Inspecting scenarios
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "pytest-httpchain"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.8.0"
|
|
4
4
|
description = "pytest plugin for HTTP testing using JSON files"
|
|
5
5
|
readme = "README.md"
|
|
6
|
-
requires-python = ">=3.13
|
|
6
|
+
requires-python = ">=3.13"
|
|
7
7
|
authors = [{ name = "Alexander Eresov", email = "aeresov@gmail.com" }]
|
|
8
8
|
dependencies = [
|
|
9
9
|
"httpx[http2]>=0.27.0",
|
|
10
|
+
"jmespath>=1.0.0",
|
|
11
|
+
"jsonschema>=4.0.0",
|
|
10
12
|
"pydantic>=2.11.7",
|
|
11
|
-
"pyrate-limiter>=
|
|
13
|
+
"pyrate-limiter>=4.0.0",
|
|
14
|
+
"pytest>=8.4",
|
|
15
|
+
"pytest-httpchain-core",
|
|
12
16
|
"pytest-httpchain-jsonref",
|
|
13
17
|
"pytest-httpchain-models",
|
|
14
18
|
"pytest-httpchain-templates",
|
|
19
|
+
"pytest-httpchain-userfunc",
|
|
15
20
|
"pytest-order>=1.3.0",
|
|
21
|
+
"simpleeval>=1.0.3",
|
|
16
22
|
"typer>=0.16.0",
|
|
17
23
|
]
|
|
18
|
-
keywords = ["testing", "pytest", "
|
|
24
|
+
keywords = ["testing", "pytest", "httpx", "http", "api", "integration-testing"]
|
|
19
25
|
license = "MIT"
|
|
20
26
|
license-files = ["LICENSE"]
|
|
21
27
|
classifiers = [
|
|
@@ -40,8 +46,6 @@ dev = [
|
|
|
40
46
|
docs = [
|
|
41
47
|
"mkdocs>=1.6.1",
|
|
42
48
|
"mkdocs-material>=9.6.16",
|
|
43
|
-
"mkdocstrings>=0.30.0",
|
|
44
|
-
"mkdocstrings-python>=1.16.12",
|
|
45
49
|
]
|
|
46
50
|
|
|
47
51
|
[tool.uv]
|
|
@@ -107,15 +111,6 @@ pythonpath = [
|
|
|
107
111
|
]
|
|
108
112
|
testpaths = ["tests", "packages/*/tests"]
|
|
109
113
|
|
|
110
|
-
[tool.pyright]
|
|
111
|
-
exclude = [".tox/"]
|
|
112
|
-
ignore = [".venv/"]
|
|
113
|
-
reportMissingImports = "error"
|
|
114
|
-
reportMissingTypeStubs = false
|
|
115
|
-
reportExplicitAny = false
|
|
116
|
-
typeCheckingMode = "off"
|
|
117
|
-
pythonPlatform = "Linux"
|
|
118
|
-
|
|
119
114
|
[tool.coverage.run]
|
|
120
115
|
source = [
|
|
121
116
|
"src",
|
|
@@ -21,3 +21,10 @@ Example test file (test_api.http.json):
|
|
|
21
21
|
]
|
|
22
22
|
}
|
|
23
23
|
"""
|
|
24
|
+
|
|
25
|
+
# Re-export the user-facing warning so consumers can filter it without reaching
|
|
26
|
+
# into the plugin module. The definition stays in plugin.py because the pytest11
|
|
27
|
+
# entry point and the collection hook reference it there directly.
|
|
28
|
+
from pytest_httpchain.plugin import ScenarioValidationWarning
|
|
29
|
+
|
|
30
|
+
__all__ = ["ScenarioValidationWarning"]
|