Pytest plugin to load resource files relative to test code and to expect values to match them.
Project description
pytest-respect
Pytest plugin to load resource files relative to test code and to expect values to match them. The name is a contraction of resources.expect, which is frequently typed when using this plugin.
The primary use-case is running tests over moderately large datasets where adding them as constants in the test code would be cumbersome. This happens frequently with integration tests or when retrofitting tests onto an existing code-base.
Example
The absolute simplest example is the following test. If it is found in a file called foo/test_stuff.py, then it will load the content of foo/test_stuff/test_computation__input.json, run the compute function on it, and assert that the output exactly matches the content of the file foo/test_stuff/test_computation__output.json.
def test_computation(resources):
"""Running compute on input.json creates an output matching output.json"""
input = resources.load_json("input")
output = compute(input)
resources.expect_json(output, "output")
Project details
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_respect-0.0.1.tar.gz.
File metadata
- Download URL: pytest_respect-0.0.1.tar.gz
- Upload date:
- Size: 51.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8641423eef47409a9159137753b15e4b7205dfd71f1f12e5e3b5ea2e883fc626
|
|
| MD5 |
dc986b03b41c3a261aa16a5617247963
|
|
| BLAKE2b-256 |
ab099693f2fe2cecc437e7ec93f3972e303db24497eaa8ec3d81df94610866ed
|
File details
Details for the file pytest_respect-0.0.1-py3-none-any.whl.
File metadata
- Download URL: pytest_respect-0.0.1-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21c132af884ce0ab6c4842d83dd972e121d314079d5f84f62fbdc299999c0192
|
|
| MD5 |
9e27abbe7b1cbf21e801dd2d442d18b0
|
|
| BLAKE2b-256 |
adccd80d9dd3e2a2a1fdc80eba58c11acec41342be48605ef60f21b28559f0d4
|