Install the package and enable the pytest plugin:
pip install cmd-mox
On Windows the wheel also pulls in pywin32, which provides the win32pipe
and win32file modules that power CmdMox's named-pipe IPC transport.
In your conftest.py:
pytest_plugins = ("cmd_mox.pytest_plugin",)
Each test receives a cmd_mox fixture that provides access to the controller
object. The plugin enters replay mode before the test body executes and
performs verification during teardown, so most tests only need to declare
expectations and exercise the code under test. If both the test body and
verification fail, the verification error is suppressed so the original test
failure surfaces. Automatic replay/verify can be disabled globally via the
cmd_mox_auto_lifecycle pytest.ini option or per test with
@pytest.mark.cmd_mox(auto_lifecycle=False). Command-line flags
--cmd-mox-auto-lifecycle and --no-cmd-mox-auto-lifecycle override both
settings for a single pytest run.