Parallel execution and isolation

Version 0.2.0 Updated Nov 27, 2025

CmdMox test runs are isolated even when executed in parallel with pytest-xdist or other multiprocessing strategies. Every controller instance creates its own temporary shim directory via tempfile.mkdtemp and the IPC socket lives inside that directory (ipc.sock). The pytest plugin further decorates the directory prefix with the worker ID and process ID so concurrent workers never clash on shared filesystems. When the fixture tears down the environment manager removes the directory, ensuring sockets and shims do not leak between tests.

To verify that the test suite behaves correctly in parallel, run pytest with multiple workers:

pytest -n auto

On Windows the dedicated smoke workflow that powers CI can be run via the Makefile:

make windows-smoke

The target captures IPC debug output in windows-ipc.log, facilitating attachment of shim diagnostics to CI artefacts or reproduction of Windows-specific issues locally.

Each test continues to receive an independent cmd_mox fixture; the environmental changes are scoped to the worker process, so tests cannot observe one another's shims or sockets. When controllers are constructed manually outside pytest, the same pattern should be followed—instantiate a new cmd_mox.CmdMox per test case so that every run receives its own environment manager.