--- id: freeze-uuid version: "0.4.3" license: unclear license_treatment: permissive maintenance: dormant --- # freeze-uuid — Python package for mocking uuid. License: permissive · Maintenance: dormant · Downloads: 106.0K/mo ## 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 above — 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 pip install freeze-uuid uv add freeze-uuid 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_current - Install friction: low - Maintenance: dormant - Downloads: 106.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags mock uuid in tests, freeze uuid values, uuid testing decorator, deterministic uuid generation, uuid test fixture, patch uuid module, uuid mocking library, testing, mocking, uuid [View on SkillFed](https://skillfed.io/packages/freeze-uuid) · [View on PyPI](https://pypi.org/project/freeze-uuid/)