skillfed

freeze-uuid

Python package for mocking uuid.

freeze-uuid v0.4.3 106.0K downloads/30d#12,671 on PyPI1
Permissive license DORMANT released

What it is and what it does

freeze-uuid is a testing utility that replaces Python's uuid module with a mock that returns fixed or sequenced UUID values. It works as a decorator on test functions or as a context manager, allowing you to control exactly what UUIDs are generated during test execution. This eliminates randomness in tests that depend on UUID generation, making them deterministic and reproducible.

The package supports single fixed UUIDs, default zero-filled UUIDs, lists of sequential UUIDs, and async test functions. It mocks the underlying uuid.UUID class, so it works with any library that generates UUIDs through the standard module. With zero runtime dependencies and a pure-Python wheel, it installs with minimal friction.

Use it for:

  • Write deterministic unit tests for code that generates or uses UUIDs without relying on random values.
  • Test database operations where UUID primary keys must match expected values across test runs.
  • Verify UUID handling in async functions using pytest with parametrized test cases.
  • Mock UUID generation in libraries that build on the standard uuid module.
  • Create reproducible integration tests where UUID sequences need to be predictable.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Decorator and context manager to mock Python's uuid module, returning fixed or sequenced UUIDs in tests instead of generating random ones.

Yes, if you write tests for code that generates UUIDs and need deterministic behavior. The package is lightweight, has no dependencies, and solves a real testing problem. However, maintenance is dormant, so it will not receive bug fixes or updates—acceptable for a stable, narrow-scope utility but worth noting if you need ongoing support.

Install

freeze-uuid on PyPI

pip

pip install freeze-uuid

uv

uv add freeze-uuid

poetry

poetry add freeze-uuid

Installing freeze-uuid

Before you install

Low friction: pure Python wheel with no runtime dependencies. Maintenance is dormant—last commit 2024-05-04, no activity since—so expect no updates or bug fixes going forward.

License in practice

MIT license (permissive) means you can use, modify, and distribute freely with minimal restrictions.

Quickstart

pip install freeze-uuid

from freeze_uuid import freeze_uuid
import uuid

@freeze_uuid('12af6b44-8181-11ee-b890-628ab7cd4d99')
def test_example():
    assert str(uuid.uuid4()) == '12af6b44-8181-11ee-b890-628ab7cd4d99'

Requires Python 3.9 or later.

Verify before relying

  • Whether the package works correctly with all uuid generation methods beyond uuid1 and uuid4.
  • Compatibility with async test frameworks beyond the pytest.mark.asyncio example shown.
  • Whether dormant maintenance status will affect compatibility with future Python versions.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance dormant — 832 days since the last release
Last repo commit
First released
Downloads 106,021/month — #12,671 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: freeze_uuid-0.4.3-py3-none-any.whl

License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3

Tags

mock uuid in testsfreeze uuid valuesuuid testing decoratordeterministic uuid generationuuid test fixturepatch uuid moduleuuid mocking library
testingmockinguuid

More Testing packages