Whitesmith
Test helper for blacksmith resources.
Motivation
While using blacksmith, resources are declared using pydantic, and, while testing, we never do http calls.
Whitesmith is a helper that create pytest fixtures for blacksmith resources and generate handlers for tests.
Usage
Generating fixtures
whitesmith generate -m my_package.resources --out-dir tests/
The commande above will generate a folder tests/whitesmith containing
handlers for all the api call with a default implementation.
Note If you run the command again, the command does not overrite generated files. To generate newer version, use the
--overwriteflag.
Those fixtures can be adapted to get the result you want, they must be present in a whitesmith_handlers directory inside the tests suite.
Using the fixtures
The whitesmith package provide three pytest fixtures that can be used in the testsuite.
The sync_blacksmith_client, async_blacksmith_client can be used to get a blacksmith client instance that use the installed fixtures from the generated directory.
Both actually consume the undelying fixtures whitesmith_router is a generated
fixture that contains all the routes contained in the whitesmith_handlers directory.
Metadata
Release files for whitesmith 5.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| whitesmith-5.2.3.tar.gz | 12.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| whitesmith-5.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.5 kB
Release files / whitesmith-5.2.3.tar.gz
| Download URL | whitesmith-5.2.3.tar.gz |
|---|---|
| Size | 12.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
76531fa840af8edfd3af7779a8b5e8abf90993da4d89d90fbc013cd9493ca671
|
|
BLAKE2b-256 checksum How to use checksums |
24e95677e140f398dd5396040a8794c5adceae66d857c60c3cdd58da7b116dc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
pdm/2.26.7 CPython/3.13.12 Linux/6.14.0-1017-azure
|
Release files / whitesmith-5.2.3-py3-none-any.whl
| Download URL | whitesmith-5.2.3-py3-none-any.whl |
|---|---|
| Size | 15.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d8070c89f5a173382d72e8ef47d7f22db020ca52fcbd5e3b3ff2ed6e8948877a
|
|
BLAKE2b-256 checksum How to use checksums |
74b38bd9cd7aaee05b4e4ba75971a02f42bca20bb287031f5cbd362b3de2f7b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
pdm/2.26.7 CPython/3.13.12 Linux/6.14.0-1017-azure
|