User functions support for pytest-httpchain
Project description
pytest-httpchain-userfunc
Dynamic import and invocation of user-defined functions for pytest-httpchain.
This package resolves a function from an explicit module.path:function_name
reference and calls it. A bare name with no module path is rejected. It exposes
import_function (resolve only), call_function (resolve and call), and
wrap_function (build a callable with default args/kwargs that are merged with
call-time arguments). Import and runtime failures are raised as
UserFunctionError with the underlying cause appended to the message, so the
reason is visible even where only the message text is rendered.
Role in the workspace
pytest-httpchain lets a scenario hook into user Python for custom
authentication, response verification, data extraction, and substitution
functions, each referenced as module:function. The plugin uses this package
to import and invoke those references at the right point in a stage's lifecycle.
It is published separately so the import/invocation logic can be reused and
tested on its own.
Usage
from pytest_httpchain_userfunc import call_function, wrap_function, UserFunctionError
try:
result = call_function("mypackage.checks:status_ok", response)
wrapped = wrap_function("mypackage.checks:equals", default_kwargs={"expected": 200})
wrapped(response) # default_kwargs merged with call-time kwargs
except UserFunctionError as e:
print(f"user function failed: {e}")
Links
- Documentation: https://aeresov.github.io/pytest-httpchain/
- Source and issues: https://github.com/aeresov/pytest-httpchain
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytest_httpchain_userfunc-0.7.0.tar.gz.
File metadata
- Download URL: pytest_httpchain_userfunc-0.7.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf669c568e595e88e154b6a1a87a3014923c49b663261cfa176f6003d5559283
|
|
| MD5 |
1ce66c99263b89a99e0b4d30581e27c2
|
|
| BLAKE2b-256 |
c8a4ee5644faa9ffd6b962c2cadf866bb0408f61edb40031f1bd45d19ab23252
|
Provenance
The following attestation bundles were made for pytest_httpchain_userfunc-0.7.0.tar.gz:
Publisher:
publish.yml on aeresov/pytest-httpchain
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytest_httpchain_userfunc-0.7.0.tar.gz -
Subject digest:
bf669c568e595e88e154b6a1a87a3014923c49b663261cfa176f6003d5559283 - Sigstore transparency entry: 1823975390
- Sigstore integration time:
-
Permalink:
aeresov/pytest-httpchain@0f61ddc029c040e81cc8cbaca94561586e04c716 -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/aeresov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0f61ddc029c040e81cc8cbaca94561586e04c716 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pytest_httpchain_userfunc-0.7.0-py3-none-any.whl.
File metadata
- Download URL: pytest_httpchain_userfunc-0.7.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7126565b5899928522b909e5e11d17f1ab79fc46a02e372f4bfcfda237bff47
|
|
| MD5 |
520423fd36273086622992085bdc86ed
|
|
| BLAKE2b-256 |
2a234ebe3601a30292b8a88472647870d513bffef42fa2430c6a2de488777c91
|
Provenance
The following attestation bundles were made for pytest_httpchain_userfunc-0.7.0-py3-none-any.whl:
Publisher:
publish.yml on aeresov/pytest-httpchain
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytest_httpchain_userfunc-0.7.0-py3-none-any.whl -
Subject digest:
f7126565b5899928522b909e5e11d17f1ab79fc46a02e372f4bfcfda237bff47 - Sigstore transparency entry: 1823976025
- Sigstore integration time:
-
Permalink:
aeresov/pytest-httpchain@0f61ddc029c040e81cc8cbaca94561586e04c716 -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/aeresov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0f61ddc029c040e81cc8cbaca94561586e04c716 -
Trigger Event:
release
-
Statement type: