pytest-httpchain 0.18.1__tar.gz → 0.19.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.
Files changed (56) hide show
  1. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/PKG-INFO +6 -2
  2. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/README.md +5 -1
  3. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/pyproject.toml +3 -2
  4. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/pyproject.toml.orig +5 -2
  5. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/__init__.py +4 -2
  6. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/carrier.py +479 -80
  7. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/cli.py +7 -1
  8. pytest_httpchain-0.19.0/src/pytest_httpchain/connections.py +931 -0
  9. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/constants.py +6 -3
  10. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/dataflow.py +72 -7
  11. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/models/__init__.py +14 -1
  12. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/models/entities.py +178 -13
  13. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/models/types.py +36 -0
  14. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/plugin.py +37 -5
  15. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/redaction.py +135 -6
  16. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/report_formatter.py +143 -1
  17. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/response_steps.py +175 -30
  18. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/scoping.py +229 -3
  19. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/templates/functions.py +8 -0
  20. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/userfunc.py +32 -2
  21. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/utils.py +18 -0
  22. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/validation/deep.py +114 -7
  23. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/validation/diagnostics.py +13 -0
  24. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/validation/loader.py +32 -8
  25. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/validation/semantic.py +422 -59
  26. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/LICENSE +0 -0
  27. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/body_schema.py +0 -0
  28. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/errors.py +0 -0
  29. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/factory.py +0 -0
  30. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/har_writer.py +0 -0
  31. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/importers/__init__.py +0 -0
  32. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/importers/builder.py +0 -0
  33. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/importers/curl.py +0 -0
  34. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/importers/har.py +0 -0
  35. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/jsonref/__init__.py +0 -0
  36. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/jsonref/equality.py +0 -0
  37. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/jsonref/exceptions.py +0 -0
  38. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/jsonref/jsonc.py +0 -0
  39. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/jsonref/loader.py +0 -0
  40. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/jsonref/plumbing/__init__.py +0 -0
  41. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/jsonref/plumbing/circular.py +0 -0
  42. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/jsonref/plumbing/path.py +0 -0
  43. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/jsonref/plumbing/reference.py +0 -0
  44. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/parallel_stats.py +0 -0
  45. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/py.typed +0 -0
  46. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/request_builder.py +0 -0
  47. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/schema.py +0 -0
  48. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/templates/__init__.py +0 -0
  49. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/templates/exceptions.py +0 -0
  50. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/templates/expressions.py +0 -0
  51. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/templates/substitution.py +0 -0
  52. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/validation/__init__.py +0 -0
  53. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/validation/discovery.py +0 -0
  54. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/validation/validate.py +0 -0
  55. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/warnings.py +0 -0
  56. {pytest_httpchain-0.18.1 → pytest_httpchain-0.19.0}/src/pytest_httpchain/wire_codec.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytest-httpchain
3
- Version: 0.18.1
3
+ Version: 0.19.0
4
4
  Summary: pytest plugin for HTTP testing using JSON files
5
5
  Keywords: testing,pytest,httpx,http,api,integration-testing
6
6
  Author: Alexander Eresov
@@ -100,6 +100,10 @@ JSON, MessagePack, form, XML, text, base64, a binary file and GraphQL, and multi
100
100
  - **User functions** — Call Python functions for custom extraction, verification, or [authentication](https://www.python-httpx.org/advanced/authentication/#custom-authentication-schemes)
101
101
  - **Failure reports** — A failing verify step lists every check that failed, not only the first, and the report gives the request as a ready-to-run `curl` command beside the request and response it shows
102
102
 
103
+ ### Socket protocols via adapters
104
+
105
+ Not every service a test talks to speaks HTTP. A `connection` stage drives a long-lived connection through an adapter, a small Python class you write that connects, sends one message and decodes the next: `"connection": {"name": "device", "send": {"op": "ping"}, "expect": {"match": {"op": "pong"}, "timeout": 2}}`. Every message received is queued for the stages that wait for it; `expect` takes the one that matches, asserts that none arrives (`absent`) or that the other side hangs up (`closed`), and the same `verify` and `save` steps an HTTP stage uses check it. HTTP and connection stages mix in one chain, sharing what they save. See [Connections](https://aeresov.github.io/pytest-httpchain/usage/connections/).
106
+
103
107
  ### Scenario-wide client settings
104
108
 
105
109
  A scenario's `client` block sets up the HTTP client all its stages share, once: a base URL their relative URLs are appended to, headers and query parameters sent with every request, timeout, redirects, proxy, HTTP/2 and connection pool. A stage overrides what it needs.
@@ -226,7 +230,7 @@ pip install 'git+https://github.com/aeresov/pytest-httpchain@main'
226
230
  You can limit the depth of relative path traversal using the `httpchain_ref_parent_traversal_depth` ini option, default value is **3**.
227
231
  - Template expressions support list/dict comprehensions. You can limit the maximum comprehension length using the `httpchain_max_comprehension_length` ini option, default value is **50000**.
228
232
  - Parallel stage iterations (repeat/foreach) have a safety limit configurable via the `httpchain_max_parallel_iterations` ini option, default value is **10000**.
229
- - A failing stage's report prints the values of credential headers and query parameters as `[REDACTED]`, keeping their names (and cookie names). The lists are set by the `httpchain_redact_headers` ini option, default **Authorization Proxy-Authorization Cookie Set-Cookie X-API-Key API-Key X-Auth-Token**, and `httpchain_redact_query_params`, default **access_token refresh_token id_token api_key apikey client_secret password token**; an empty value disables one. Request and response bodies, and DEBUG logs, are not redacted. See [Secrets in reports](https://aeresov.github.io/pytest-httpchain/getting-started/#secrets-in-reports).
233
+ - A failing stage's report prints the values of credential headers and query parameters as `[REDACTED]`, keeping their names (and cookie names). The lists are set by the `httpchain_redact_headers` ini option, default **Authorization Proxy-Authorization Cookie Set-Cookie X-API-Key API-Key X-Auth-Token**, and `httpchain_redact_query_params`, default **access_token refresh_token id_token api_key apikey client_secret password token**; an empty value disables one. A connection stage's messages are redacted by key, at any depth, by `httpchain_redact_message_keys`, default both lists lowercased. Request and response bodies, and DEBUG logs, are not redacted. See [Secrets in reports](https://aeresov.github.io/pytest-httpchain/getting-started/#secrets-in-reports).
230
234
 
231
235
  ### HAR export
232
236
 
@@ -62,6 +62,10 @@ JSON, MessagePack, form, XML, text, base64, a binary file and GraphQL, and multi
62
62
  - **User functions** — Call Python functions for custom extraction, verification, or [authentication](https://www.python-httpx.org/advanced/authentication/#custom-authentication-schemes)
63
63
  - **Failure reports** — A failing verify step lists every check that failed, not only the first, and the report gives the request as a ready-to-run `curl` command beside the request and response it shows
64
64
 
65
+ ### Socket protocols via adapters
66
+
67
+ Not every service a test talks to speaks HTTP. A `connection` stage drives a long-lived connection through an adapter, a small Python class you write that connects, sends one message and decodes the next: `"connection": {"name": "device", "send": {"op": "ping"}, "expect": {"match": {"op": "pong"}, "timeout": 2}}`. Every message received is queued for the stages that wait for it; `expect` takes the one that matches, asserts that none arrives (`absent`) or that the other side hangs up (`closed`), and the same `verify` and `save` steps an HTTP stage uses check it. HTTP and connection stages mix in one chain, sharing what they save. See [Connections](https://aeresov.github.io/pytest-httpchain/usage/connections/).
68
+
65
69
  ### Scenario-wide client settings
66
70
 
67
71
  A scenario's `client` block sets up the HTTP client all its stages share, once: a base URL their relative URLs are appended to, headers and query parameters sent with every request, timeout, redirects, proxy, HTTP/2 and connection pool. A stage overrides what it needs.
@@ -188,7 +192,7 @@ pip install 'git+https://github.com/aeresov/pytest-httpchain@main'
188
192
  You can limit the depth of relative path traversal using the `httpchain_ref_parent_traversal_depth` ini option, default value is **3**.
189
193
  - Template expressions support list/dict comprehensions. You can limit the maximum comprehension length using the `httpchain_max_comprehension_length` ini option, default value is **50000**.
190
194
  - Parallel stage iterations (repeat/foreach) have a safety limit configurable via the `httpchain_max_parallel_iterations` ini option, default value is **10000**.
191
- - A failing stage's report prints the values of credential headers and query parameters as `[REDACTED]`, keeping their names (and cookie names). The lists are set by the `httpchain_redact_headers` ini option, default **Authorization Proxy-Authorization Cookie Set-Cookie X-API-Key API-Key X-Auth-Token**, and `httpchain_redact_query_params`, default **access_token refresh_token id_token api_key apikey client_secret password token**; an empty value disables one. Request and response bodies, and DEBUG logs, are not redacted. See [Secrets in reports](https://aeresov.github.io/pytest-httpchain/getting-started/#secrets-in-reports).
195
+ - A failing stage's report prints the values of credential headers and query parameters as `[REDACTED]`, keeping their names (and cookie names). The lists are set by the `httpchain_redact_headers` ini option, default **Authorization Proxy-Authorization Cookie Set-Cookie X-API-Key API-Key X-Auth-Token**, and `httpchain_redact_query_params`, default **access_token refresh_token id_token api_key apikey client_secret password token**; an empty value disables one. A connection stage's messages are redacted by key, at any depth, by `httpchain_redact_message_keys`, default both lists lowercased. Request and response bodies, and DEBUG logs, are not redacted. See [Secrets in reports](https://aeresov.github.io/pytest-httpchain/getting-started/#secrets-in-reports).
192
196
 
193
197
  ### HAR export
194
198
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pytest-httpchain"
3
- version = "0.18.1"
3
+ version = "0.19.0"
4
4
  description = "pytest plugin for HTTP testing using JSON files"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -173,6 +173,7 @@ layers = [
173
173
  "factory",
174
174
  "carrier : dataflow : schema : importers",
175
175
  "validation : har_writer : report_formatter : request_builder : response_steps : parallel_stats",
176
+ "connections",
176
177
  "body_schema",
177
178
  "scoping",
178
179
  "utils : redaction",
@@ -190,5 +191,5 @@ source_modules = ["pytest_httpchain.models"]
190
191
  forbidden_modules = ["pytest_httpchain.jsonref"]
191
192
 
192
193
  [build-system]
193
- requires = ["uv_build>=0.12,<0.13"]
194
+ requires = ["uv_build>=0.12,<0.14"]
194
195
  build-backend = "uv_build"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pytest-httpchain"
3
- version = "0.18.1"
3
+ version = "0.19.0"
4
4
  description = "pytest plugin for HTTP testing using JSON files"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -88,7 +88,7 @@ docs = [
88
88
  default-groups = ["dev", "docs"]
89
89
 
90
90
  [build-system]
91
- requires = ["uv_build>=0.12,<0.13"]
91
+ requires = ["uv_build>=0.12,<0.14"]
92
92
  build-backend = "uv_build"
93
93
 
94
94
  [tool.uv.build-backend]
@@ -218,6 +218,9 @@ layers = [
218
218
  # a lower layer, the domain packages included, may import it.
219
219
  "carrier : dataflow : schema : importers",
220
220
  "validation : har_writer : report_formatter : request_builder : response_steps : parallel_stats",
221
+ # connections is the connection stages' sessions and readers, below
222
+ # response_steps, which judges a message: the carrier injects the match.
223
+ "connections",
221
224
  "body_schema",
222
225
  # scoping reads stage marks with utils.make_marker (scoping.SkipCause).
223
226
  "scoping",
@@ -2,9 +2,11 @@
2
2
 
3
3
  Test scenarios are JSON files (``test_<name>.http.json``, or ``.http.jsonc``;
4
4
  comments and trailing commas allowed in either) with ``$ref`` support,
5
- ``{{ expr }}`` templates, and multi-stage request chaining.
5
+ ``{{ expr }}`` templates, and multi-stage request chaining. A connection
6
+ stage talks over a protocol adapter instead (`ProtocolAdapter`).
6
7
  """
7
8
 
9
+ from pytest_httpchain.connections import ProtocolAdapter
8
10
  from pytest_httpchain.warnings import ScenarioValidationWarning
9
11
 
10
- __all__ = ["ScenarioValidationWarning"]
12
+ __all__ = ["ProtocolAdapter", "ScenarioValidationWarning"]