Mirakuru is a Python library designed for process orchestration, primarily used in functional and integration tests. It facilitates starting and stopping external processes (such as databases, APIs, or other services) and waiting for a clear indication that they are ready before allowing the main application or test suite to proceed. The library is currently at version 3.0.2 and is actively maintained, with releases typically addressing bug fixes, enhancements, and compatibility updates.
pip install mirakuruVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `TCPExecutor` to ensure a local HTTP server (simulated here with Python's built-in `http.server`) is ready to accept connections on a specific port before proceeding. It also shows proper cleanup. Mirakuru's executors can also be used as context managers for automatic startup and shutdown.
Upgrade Python to version 3.10 or higher.
Employ context managers (`with`) or ensure `.stop()` is called in a `try...finally` block.
Ensure the target port is free before starting the executor, or handle the `AlreadyRunning` exception appropriately (e.g., by checking if the existing process is the intended one).
Prefer passing commands as a list of arguments rather than a single string with `shell=True` where possible. Verify process tree termination in integration tests for complex scenarios.
Ensure that the port is free before starting the `mirakuru` executor, or configure your process to use a different available port. You can check port availability using tools like `lsof -i :PORT` (Linux/macOS) or `netstat -ano | findstr :PORT` (Windows).
Increase the `timeout` parameter when initializing the `Executor` (e.g., `executor = OutputExecutor('my_command', timeout=60)`), or investigate why your subprocess is taking longer to start or become ready. Ensure the readiness check parameters (e.g., `banner` for `OutputExecutor`, `port` for `TCPExecutor`, `url` for `HTTPExecutor`) are correctly configured.Verify that the command string points to a valid executable, including its full path if it's not in the system's PATH. For example, if 'my_server' is in your current directory, use `'./my_server'` or the absolute path.
Ensure that the executable file or script passed to `mirakuru.Executor` has execute permissions for the user running the Python script. On Linux/macOS, you can grant execute permissions using `chmod +x ./my_script.sh`.
No dependency data recorded yet.