looptime
Fast-forward asyncio event loop time (in tests)
Decision gist · record as of 2026-08-14
Yes, if you have asyncio-based tests with explicit time delays. Install it for any suite using asyncio that includes sleeps, timeouts, or time-dependent logic—it integrates transparently, has no dependencies, and is actively maintained. Skip it if your tests have no explicit delays or use only synchronous code.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- Low friction: pure Python wheel with no runtime dependencies.
- Actively maintained as of 2026-01-03 with recent commits.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects with minimal obligations.
last release 2026-01-03 (223 days) · last repo commit 2026-03-13 · 41 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 305,147 downloads/mo, #7,797 on PyPI
Alternatives
Verify before relying
pip install looptime
import asyncio
await asyncio.sleep(100)
assert asyncio.get_running_loop().time() == 100- Whether looptime works with all asyncio patterns or only a subset of time-dependent scenarios.
- Performance impact on very large test suites or tests with many concurrent tasks.
- Compatibility with third-party asyncio event loop implementations beyond CPython and PyPy.
- Integration requirements with test frameworks beyond those mentioned in classifiers.
What it is and what it does
Looptime is a plugin that intercepts asyncio's internal clock, allowing tests to advance time instantly while the event loop sees the full passage. From the loop's perspective, sleeps, timeouts, and delayed callbacks execute in zero real time; from the observer's perspective, a test that would normally take minutes runs in seconds or less. It was originally built for Kopf, a framework for Kubernetes Operators in Python, where it reduced approximately 7000 unit tests to approximately 2 minutes.
The library does not speed up tests that are slow for reasons unrelated to explicit time delays—such as local network I/O, heavy computation, or data processing. It only compacts asyncio-based timing primitives. It works transparently and can be enabled globally or per-test, with no changes to test code itself.
Use it for
- Speed up asyncio test suites that use sleeps, timeouts, or rate limiters without breaking time-dependent assertions.
- Test retry logic, exponential backoff, or other delay-based patterns in near-zero real time.
- Verify event loop scheduling and callback ordering without waiting for actual delays.
- Reduce CI/CD pipeline duration for projects with large asyncio test suites.
- Test long-running background tasks or periodic jobs that would otherwise take minutes per test.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you have asyncio-based tests with explicit time delays.
Install it for any suite using asyncio that includes sleeps, timeouts, or time-dependent logic—it integrates transparently, has no dependencies, and is actively maintained. Skip it if your tests have no explicit delays or use only synchronous code.
Install
looptime on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Actively maintained as of 2026-01-03 with recent commits.
Requires Python 3.10 or later.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects with minimal obligations.
Quickstart
pip install looptime
import asyncio
await asyncio.sleep(100)
assert asyncio.get_running_loop().time() == 100
Verify before relying
- Whether looptime works with all asyncio patterns or only a subset of time-dependent scenarios.
- Performance impact on very large test suites or tests with many concurrent tasks.
- Compatibility with third-party asyncio event loop implementations beyond CPython and PyPy.
- Integration requirements with test frameworks beyond those mentioned in classifiers.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 223 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 305,147 / month, #7,797 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Framework :: AsyncIOFramework :: PytestFramework :: aiohttpIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: LibrariesTopic :: Software Development :: TestingTyping :: Typed |
Evidence: looptime-0.7-py3-none-any.whl
Tags
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 › “asyncio time mocking”
- looptimeLooptime fakes the passage of time in asyncio event loops during…
- aresponsesMocks external HTTP/HTTPS services for asyncio-based tests by…
- asyncmockProvides awaitable mock objects for testing async code, extending the…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
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.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
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.
See also time-machine · pytest-asyncio · asyncmock · aresponses · pytest-freezer · pytest-loop · pytest-asyncio-concurrent · aiocop · loop-rate-limiters · waiter