Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

fixturify

Latest version: v0.1.42

Overview

Last scanned
27 Nov 2026
Published
27 Nov 2026
PyPI package Publisher: eleven-sea
2 Versions
2.6K Downloads

Scan summary

fixturify was last scanned on 27 Nov 2026 at version 0.1.42. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 2 versions, all published within 2 days (26 and 27 Nov 2026).
  • Findings: No rules fired in version 0.1.42.
  • Downloads: 2,552 downloads.

Versions

2 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.1.42 LATEST 27 Nov 2026 No rules fired
0.1.41 26 Nov 2026 No rules fired

No rules fired in 0.1.42

Findings

Findings for v0.1.42. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 0.1.42; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

fixturify

A collection of Python testing utilities for SQL, HTTP mocking, JSON fixtures, assertions, and object mapping.

Installation

pip install fixturify

Table of contents

  • sql - Execute SQL files before/after tests
  • SqlAssert - Fluent database assertions
  • http - Record and replay HTTP calls
  • read - Inject JSON fixtures into tests
  • JsonAssert - Compare objects to JSON files or in-memory JSON
  • ObjectMapper - Bidirectional object-JSON mapping
  • Combined usage - All modules together, decorator stacking

sql

Decorator for executing SQL files before and/or after tests.

from fixturify import sql, Phase, SqlTestConfig

Basic usage

@sql(path="./setup.sql")
def test_something():
    # SQL executed before test
    pass

Decorator parameters

Parameter Type Default Description
path str required Path to SQL file (relative to test file)
phase Phase Phase.BEFORE When to execute
config SqlTestConfig \| None None Database config (or use fixture)

Execution phases

@sql(path="./setup.sql", phase=Phase.BEFORE)
@sql(path="./cleanup.sql", phase=Phase.AFTER)
def test_with_cleanup():
    # setup.sql executed before test
    # cleanup.sql executed after test (even if test fails)
    pass
  • Phase.BEFORE (default) - execute SQL before test
  • Phase.AFTER - execute SQL after test, runs in finally block (always executes, even on failure)

On a fixture, use a yield fixture for cleanup — its Phase.AFTER scripts run at teardown, after the test (also when the test fails). On a fixture that returns, they run right after the fixture function, i.e. before the test; fixturify warns about this. A yield fixture takes the config from its own arguments, so request your config fixture (or request) there:

@pytest.fixture
@sql(path="./cleanup.sql", phase=Phase.AFTER)
def clean_tables(sql_config):
    yield

Database configuration

Via pytest fixture (recommended)
# conftest.py
import pytest
from fixturify import SqlTestConfig

@pytest.fixture
def sql_config() -> SqlTestConfig:
    return SqlTestConfig(
        driver="psycopg2",
        host="localhost",
        port=5432,
        database="testdb",
        user="postgres",
        password="postgres",
    )

Fixture is auto-discovered - no need to pass it to the decorator.

Important: The return type annotation -> SqlTestConfig is required for auto-discovery. The discovery mechanism matches fixtures by their return type annotation, so without it the fixture will not be found.

Directly in decorator
config = SqlTestConfig(
    driver="psycopg2",
    host="localhost",
    database="testdb",
    user="postgres",
    password="postgres",
)

@sql(path="./setup.sql", config=config)
def test_something():
    pass

SqlTestConfig

Field Type Required Description
driver str yes Database driver name
host str yes Database host
database str yes Database name
user str yes Username
password str yes Password
port int \| None no Port (uses driver default if omitted)

Driver name is normalized: leading + and whitespace are stripped (e.g. "postgresql+psycopg2" becomes "psycopg2").

Supported drivers

Driver Database Type Default port
psycopg2 PostgreSQL sync 5432
psycopg PostgreSQL async 5432
asyncpg PostgreSQL async 5432
mysql.connector MySQL sync 3306
aiomysql MySQL async 3306
sqlite3 SQLite sync -
aiosqlite SQLite async -

Async functions

Decorator automatically handles async test functions. Sync drivers in async tests run via thread pool executor. Async drivers in sync tests use a persistent background event loop (see Connection caching). If an async test is cancelled while a script runs, fixturify waits for that script to finish, so it can't commit after the test is gone; remaining Phase.AFTER scripts still run.

@sql(path="./setup.sql")
async def test_async():
    # Works with asyncpg, aiomysql, aiosqlite
    pass

Multiple decorators

Decorators execute top-to-bottom for BEFORE, bottom-to-top for AFTER:

@sql(path="./first.sql")   # 1st executed
@sql(path="./second.sql")  # 2nd executed
@sql(path="./cleanup.sql", phase=Phase.AFTER)  # executed after test
def test_order():
    pass

Connection caching

Connections are cached and reused between tests based on driver/host/database/user/port, and closed when the test session ends.

  • Sync drivers use one connection per database for the whole session.
  • Async drivers belong to an event loop. With pytest-asyncio's default (a new event loop per test), asyncpg and psycopg run their queries on fixturify's background loop, on a connection that is handed from one test to the next, so tests don't reconnect every time (with asyncpg that saved ~50 ms per test). Each test still starts with a clean session: settings (SET …) and temporary tables of an earlier test are reset. Tests running at the same time get separate connections. Event loops that live longer (class, module, package or session scope) keep a connection of their own on that loop, exactly as before. aiomysql and aiosqlite always use a connection per event loop (an aiosqlite ":memory:" database belongs to its loop).
  • psycopg works on Windows' default event loop (ProactorEventLoop), which psycopg itself can't use: its queries run on fixturify's background loop.
  • Processes created with fork get their own connections; the parent's connections are left untouched.

Path resolution

Paths are resolved relative to the test file:

tests/
  test_users.py      <- @sql(path="./fixtures/setup.sql")
  fixtures/
    setup.sql        <- this file will be used

SqlAssert

Fluent API for database state assertions in tests.

from fixturify import sql, SqlAssert, SqlTestConfig

Basic usage

@sql(path="./setup.sql")
def test_user_creation(sql_assert: SqlAssert):
    create_user(name="John", email="john@example.com")

    sql_assert.table("users").where(name="John").exists()

Configuration

sql_assert fixture requires a sql_config fixture returning SqlTestConfig:

# conftest.py
import pytest
from fixturify import SqlTestConfig

@pytest.fixture
def sql_config() -> SqlTestConfig:
    return SqlTestConfig(
        driver="psycopg2",
        host="localhost",
        port=5432,
        database="testdb",
        user="postgres",
        password="postgres",
    )

The sql_assert fixture is automatically available when sql_config is defined.

Entry points

sql_assert.table("users")           # TableAssert - fluent builder for table queries
sql_assert.raw(sql, params=None)    # RawQueryAssert - custom SQL queries

WHERE conditions

where(**conditions)

Add equality conditions combined with AND:

sql_assert.table("users").where(name="John", role="admin").exists()
# WHERE name = 'John' AND role = 'admin'
Chaining where()

Multiple where() calls are combined with AND:

sql_assert.table("users")\
    .where(role="admin")\
    .where(is_active=True)\
    .exists()
# WHERE role = 'admin' AND is_active = True
where_null(column)
sql_assert.table("users").where_null("deleted_at").count(5)
# WHERE deleted_at IS NULL

where(deleted_at=None) does the same (= NULL would never match in SQL).

where_not_null(column)
sql_assert.table("users").where_not_null("email").exists()
# WHERE email IS NOT NULL
where() with lists (IN)

Pass a list as a value to generate an IN (...) clause:

sql_assert.table("users").where(id=[1, 2, 3]).exists()
# WHERE id IN (1, 2, 3)

sql_assert.table("users").where(id=[1, 2, 3], role="admin").fetch_all()
# WHERE id IN (1, 2, 3) AND role = 'admin'

Empty lists raise ValueError (SQL IN () is invalid). None in a list also matches NULL: where(id=[1, None]) → WHERE (id IN (1) OR id IS NULL).

Ordering and limiting

order_by(column, desc=False)
first_user = sql_assert.table("users").order_by("created_at").fetch_one()
latest_user = sql_assert.table("users").order_by("created_at", desc=True).fetch_one()
limit(n)
top_5 = sql_assert.table("users").order_by("score", desc=True).limit(5).fetch_all()

Existence assertions

exists()

Assert at least one row matches:

sql_assert.table("users").where(name="John").exists()
not_exists()

Assert no rows match:

sql_assert.table("users").where(name="Deleted").not_exists()

Count assertions

sql_assert.table("users").count(5)       # exactly 5
sql_assert.table("users").count_gt(0)    # more than 0
sql_assert.table("users").count_gte(1)   # at least 1
sql_assert.table("users").count_lt(100)  # less than 100
sql_assert.table("users").count_lte(10)  # at most 10

Value assertions

has(**fields)

Assert first matching row has specified values:

sql_assert.table("users").where(id=1).has(
    name="John",
    email="john@example.com",
    role="admin"
)
has_all(**fields)

Assert ALL matching rows have specified values:

sql_assert.table("users").where(role="admin").has_all(is_active=True)
has_any(**fields)

Assert ANY matching row has specified values:

sql_assert.table("users").has_any(email="john@example.com")

Fetching data

fetch_one()

Fetch first matching row as dict:

row = sql_assert.table("users").where(id=1).fetch_one()
# {'id': 1, 'name': 'John', 'email': 'john@example.com'}
fetch_one(TargetClass)

Fetch and map to object using ObjectMapper:

from dataclasses import dataclass

@dataclass
class User:
    id: int
    name: str
    email: str

user = sql_assert.table("users").where(id=1).fetch_one(User)
assert isinstance(user, User)

Works with dataclasses, Pydantic models, SQLAlchemy models, SQLModel, and plain objects. Maps only flat column data from the table row - relationships are not loaded (use raw() with JOIN for that).

fetch_all()

Fetch all matching rows as list of dicts:

rows = sql_assert.table("users").fetch_all()
fetch_all(TargetClass)

Fetch all and map to objects:

users = sql_assert.table("users").fetch_all(User)
assert all(isinstance(u, User) for u in users)
fetch_value(column)

Fetch single value from first matching row:

email = sql_assert.table("users").where(id=1).fetch_value("email")
# "john@example.com"

Returns None if no rows match or column not found.

Method chaining

All query-building methods return new instances (immutable), enabling safe chaining:

sql_assert.table("users")\
    .where(role="admin")\
    .where(is_active=True)\
    .where_not_null("email")\
    .order_by("name")\
    .limit(10)\
    .fetch_all(User)

Chaining creates independent queries:

base = sql_assert.table("users")
admins = base.where(role="admin")
active_admins = admins.where(is_active=True)

# Each query is independent
base.count(100)           # all users
admins.count(10)          # only admins
active_admins.count(8)    # only active admins

Raw SQL queries

For complex queries, use raw():

# Custom query with parameters
result = sql_assert.raw(
    "SELECT COUNT(*) as cnt FROM users WHERE created_at > %s",
    ["2024-01-01"]
).fetch_one()
assert result["cnt"] > 0

# Existence check with JOIN
sql_assert.raw(
    "SELECT 1 FROM users u JOIN orders o ON u.id = o.user_id WHERE o.total > %s",
    [1000]
).exists()

# Non-existence check
sql_assert.raw(
    "SELECT 1 FROM users WHERE email LIKE %s",
    ["%@banned.com"]
).not_exists()

Parameter placeholders are automatically converted per driver (%s for psycopg2/mysql, $1 for asyncpg, ? for sqlite3).

Async support

For async tests, use methods with a prefix:

@sql(path="./setup.sql")
async def test_async(sql_assert: SqlAssert):
    await sql_assert.table("users").where(name="John").aexists()
    await sql_assert.table("users").where(name="Deleted").anot_exists()
    await sql_assert.table("users").acount(5)
    await sql_assert.table("users").acount_gt(0)
    await sql_assert.table("users").acount_gte(1)
    await sql_assert.table("users").acount_lt(100)
    await sql_assert.table("users").acount_lte(10)

    await sql_assert.table("users").where(id=1).ahas(name="John")
    await sql_assert.table("users").where(role="admin").ahas_all(is_active=True)
    await sql_assert.table("users").ahas_any(email="john@example.com")

    user = await sql_assert.table("users").where(id=1).afetch_one(User)
    users = await sql_assert.table("users").afetch_all(User)
    email = await sql_assert.table("users").where(id=1).afetch_value("email")
Async methods reference
Sync Async
exists() aexists()
not_exists() anot_exists()
count(n) acount(n)
count_gt(n) acount_gt(n)
count_gte(n) acount_gte(n)
count_lt(n) acount_lt(n)
count_lte(n) acount_lte(n)
has(**fields) ahas(**fields)
has_all(**fields) ahas_all(**fields)
has_any(**fields) ahas_any(**fields)
fetch_one() afetch_one()
fetch_all() afetch_all()
fetch_value(col) afetch_value(col)

Relationships

fetch_one(TargetClass) and fetch_all(TargetClass) map only flat column data from the queried table. Relationships are not loaded. For related data, use manual queries or raw() with JOIN:

# Manual queries
user = sql_assert.table("users").where(id=1).fetch_one()
orders = sql_assert.table("orders").where(user_id=user["id"]).fetch_all()

# Using raw() with JOIN
result = sql_assert.raw("""
    SELECT u.id, u.name, COUNT(o.id) as order_count
    FROM users u
    LEFT JOIN orders o ON u.id = o.user_id
    WHERE u.id = %s
    GROUP BY u.id, u.name
""", [1]).fetch_one()

Error messages

Clear assertion errors with context:

AssertionError: Expected at least 1 row in 'users' where name='John', found 0
AssertionError: Expected 5 rows in 'orders' where status='pending', found 3
AssertionError: Row in 'users' doesn't match expected values:
  email: expected 'john@example.com', got 'jane@example.com'
  role: expected 'admin', got 'user'

Full example

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • pypi-releases fixturify

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Ethersphere Hijacked With Crypto Stealing Malware (1)
npm

Ethersphere Hijacked With Crypto Stealing Malware Via Github & npm

Copy of Template Design OX Blog (2)
Research

NGINX2Root: Five Critical NGINX Flaws Expose Web Servers to Remote Code Execution

PolinRider Returns
Research

PolinRider Returns: Hijacked npm Packages Use Ethereum Blockchain to Conceal Malware Infrastructure

Frame 2085668439 (1)
Group 1261154229