A collection of convenient testing utilities for Python
Project description
pytools
A collection of Python testing utilities.
Installation
pip install fixturify
Modules
| Module | Description | Docs |
|---|---|---|
| sql | Execute SQL files before/after tests | docs/sql.md |
| read | Inject JSON fixtures into test functions | docs/read.md |
| http | Record and replay HTTP calls | docs/http.md |
| JsonAssert | Compare objects to JSON files | docs/json_assert.md |
| ObjectMapper | Bidirectional object-JSON mapping | docs/object_mapper.md |
Quick examples
sql
from fixturify import sql, Phase
@sql(path="./setup.sql")
@sql(path="./cleanup.sql", phase=Phase.AFTER)
def test_database():
# SQL executed before and after test
pass
read
from fixturify import read
@read.fixture(path="./fixtures/user.json", fixture_name="user", object_class=User)
def test_user(user: User):
assert user.name == "John"
http
from fixturify import http
@http(path="./fixtures/api.json")
def test_api():
# First run: records HTTP calls
# Next runs: replays from file
response = requests.get("https://api.example.com/users")
assert response.status_code == 200
JsonAssert
from fixturify import JsonAssert
def test_response():
data = {"name": "John", "age": 30}
JsonAssert(data).ignore("age").compare_to_file("./expected.json")
ObjectMapper
from fixturify import ObjectMapper
# Object to JSON
user = User(name="John", age=30)
data = ObjectMapper(user).to_json()
# JSON to object
data = {"name": "John", "age": 30}
user = ObjectMapper(data).to_object(User)
Public API
from fixturify import (
# Decorators
sql,
read,
http,
# Enums
Phase,
# Config
SqlTestConfig,
HttpTestConfig,
# Classes
JsonAssert,
ObjectMapper,
)
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 fixturify-0.1.19.tar.gz.
File metadata
- Download URL: fixturify-0.1.19.tar.gz
- Upload date:
- Size: 306.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c399bf7833cf073923d0bbea4be388e9e20969eeb1d7bd805a0ff2ee340b6f1e
|
|
| MD5 |
1cf7f136fd1eb22824b5b2d724716989
|
|
| BLAKE2b-256 |
1e6f15c8a10e4f546bd056817b3979aa20013346607c281df53f2f1a5df9ae9f
|
Provenance
The following attestation bundles were made for fixturify-0.1.19.tar.gz:
Publisher:
publish.yml on eleven-sea/pytools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fixturify-0.1.19.tar.gz -
Subject digest:
c399bf7833cf073923d0bbea4be388e9e20969eeb1d7bd805a0ff2ee340b6f1e - Sigstore transparency entry: 927138197
- Sigstore integration time:
-
Permalink:
eleven-sea/pytools@c5fa5b8b73d4094cc5375a89998bb804e7ed7bd0 -
Branch / Tag:
refs/tags/v0.1.19 - Owner: https://github.com/eleven-sea
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c5fa5b8b73d4094cc5375a89998bb804e7ed7bd0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fixturify-0.1.19-py3-none-any.whl.
File metadata
- Download URL: fixturify-0.1.19-py3-none-any.whl
- Upload date:
- Size: 105.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d3565c986b1622a4cf7498a79f09612ab54e090a0ec622e586ade5d8fc06c49
|
|
| MD5 |
7ceca0766f7fc4620ebd4bb86052620f
|
|
| BLAKE2b-256 |
3dfdc6463c80731a18f06133e26d483e5470591865215571ac634e4fc61c8e83
|
Provenance
The following attestation bundles were made for fixturify-0.1.19-py3-none-any.whl:
Publisher:
publish.yml on eleven-sea/pytools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fixturify-0.1.19-py3-none-any.whl -
Subject digest:
9d3565c986b1622a4cf7498a79f09612ab54e090a0ec622e586ade5d8fc06c49 - Sigstore transparency entry: 927138207
- Sigstore integration time:
-
Permalink:
eleven-sea/pytools@c5fa5b8b73d4094cc5375a89998bb804e7ed7bd0 -
Branch / Tag:
refs/tags/v0.1.19 - Owner: https://github.com/eleven-sea
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c5fa5b8b73d4094cc5375a89998bb804e7ed7bd0 -
Trigger Event:
push
-
Statement type: