$npx skillfedfor your agent

django-mock-queries

A django library for mocking queryset functions in memory for testing

Worth itPyPI TestingReleased Sep 2024204.8K downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — django_mock_queries-2.3.0-py2.py3-none-any.whl
v2.3.0 · released 2024-09-26

Yes. This is a mature, actively maintained testing utility with no dependencies, permissive licensing, and clear use cases for accelerating Django unit tests. Install it if you want to test query logic without database overhead; skip it only if your test suite already has fast database fixtures or you need QuerySet methods not yet supported (annotate, reverse, none, extra, raw, bulk_create, in_bulk, as_manager).AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Low friction install with no runtime dependencies.
  • Actively maintained with recent commits and stable production status since 2016.

License · maintenance · safety

MIT (permissive) — MIT license permits free use, modification, and distribution with minimal restrictions—suitable for commercial and open-source projects.

last release 2024-09-26 (687 days) · last repo commit 2026-04-14 · 324 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 204,780 downloads/mo, #9,601 on PyPI

Verify before relying

pip install django-mock-queries

from django_mock_queries.query import MockSet, MockModel

qs = MockSet(
    MockModel(mock_name='john', email='john@gmail.com'),
    MockModel(mock_name='bill', email='bill@gmail.com'),
)
result = [x for x in qs.all().filter(email__icontains='gmail.com')]
  • Whether all QuerySet methods used in production code are supported (TODO lists annotate, reverse, none, extra, raw, bulk_create, in_bulk, as_manager)
  • Performance characteristics when mocking large datasets in memory
Same gist for agents: .md · .json

What it is and what it does

django-mock-queries lets you test Django code that queries models without setting up a database. It provides in-memory MockSet and MockModel classes that mimic Django's QuerySet API, supporting method chaining, filtering with Q objects, aggregates, field lookups, and CRUD operations. This is useful when you want fast unit tests that don't require database setup or migrations.

The library is typically used by patching Django model managers in test cases, allowing you to verify query logic in isolation. It also includes utilities for testing django-rest-framework serializers and can be configured to run an entire test suite without a database by monkey-patching the test database backend, which can significantly speed up test execution for projects with many migrations.

Use it for

  • Unit test Django view logic that queries models without setting up a test database
  • Mock User.objects or other model managers in test patches to verify filter and query logic
  • Test django-rest-framework serializers with mocked model instances and nested serializers
  • Speed up test suites by running tests without database setup when database-free testing is feasible
  • Verify QuerySet method chaining and complex filter combinations with Q objects in isolation

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

This is a mature, actively maintained testing utility with no dependencies, permissive licensing, and clear use cases for accelerating Django unit tests. Install it if you want to test query logic without database overhead; skip it only if your test suite already has fast database fixtures or you need QuerySet methods not yet supported (annotate, reverse, none, extra, raw, bulk_create, in_bulk, as_manager).

Install

django-mock-queries on PyPI

Before you install

Low friction install with no runtime dependencies. Actively maintained with recent commits and stable production status since 2016.

License in practice

MIT license permits free use, modification, and distribution with minimal restrictions—suitable for commercial and open-source projects.

Quickstart

pip install django-mock-queries

from django_mock_queries.query import MockSet, MockModel

qs = MockSet(
    MockModel(mock_name='john', email='john@gmail.com'),
    MockModel(mock_name='bill', email='bill@gmail.com'),
)
result = [x for x in qs.all().filter(email__icontains='gmail.com')]

Verify before relying

  • Whether all QuerySet methods used in production code are supported (TODO lists annotate, reverse, none, extra, raw, bulk_create, in_bulk, as_manager)
  • Performance characteristics when mocking large datasets in memory

Package facts

LicenseMIT permissive
Python supportNot specified
Install frictionLow. Pure-Python wheel
Runtime dependenciesNone
MaintenanceActively maintained 687 days since the last release
Last repo commit
First released
Downloads204,780 / month, #9,601 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3 :: OnlyTopic :: Software Development :: TestingTopic :: Software Development :: Testing :: MockingTopic :: Software Development :: Testing :: Unit

Evidence: django_mock_queries-2.3.0-py2.py3-none-any.whl

Tags

Capabilities
django queryset mockingin-memory django testingmock django ormdjango unit test fixturesdjango query testing without databasemock django modelsdjango test doubles
Topics
django-testingunit-testingmocking
PyPI keywords
djangoormmockingunit-testingtdd

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “django queryset mocking”

Give your agent the search over MCP, or paste the wish link into any chat.

More Testing packages

pluggy Worth it
PyPI · Libraries · released May 2025

Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.

Install it if you're building an extensible application or framework.

MITpure Python · 3.9+aging
1.3Bdownloads / mo
pytest Worth it
PyPI · Libraries · released Jun 2026

pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.

MITpure Python · 3.10+
1.1Bdownloads / mo
virtualenv Worth it
PyPI · Libraries · released Aug 2026

virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.

MITpure Python · 3.9+
532.9Mdownloads / mo
coverage Worth it
PyPI · Testing · released Aug 2026

Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.

Install it if you want to measure test completeness or enforce coverage thresholds in your project.

permissive licensepure Python · 3.10+
335.8Mdownloads / mo
pytest-asyncio Worth it
PyPI · Testing · released May 2026

pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.

Install it if you write tests for any asyncio-based code.

Apache-2.0pure Python · 3.10+
275.9Mdownloads / mo
pytest-json-ctrf Worth it
PyPI · Testing · released Jul 2026

A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.

Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.

MITpure Python · 3.8+
273.0Mdownloads / mo

See also mock-alchemy · djangorestframework-bulk · django-query-builder · django-cacheops · django-zen-queries · djangorestframework-filters · django-user-sessions · alchemy-mock · django-chunkator · django-sql-utils