debian-forge/osbuild/testutil
Michael Vogt 7b5d6e4bd9 testutil: add new mock_command context manager
The new `testutil.mock_command` context manager can be used to
mock commands in PATH and replace them with arbitrary shell
scripts. This is useful in testing to e.g. simulate exact error
conditions that would be hard to trigger otherwise or to replace
long running commands with faked results.

Example:
```
fake_cmd = textwrap.dedent("""\
do-something
""")
with mock_command("some-cmd", fake_cmd):
   your_code
```
2024-02-12 17:41:21 -08:00
..
__init__.py testutil: add new mock_command context manager 2024-02-12 17:41:21 -08:00
imports.py osbuild: add new testutil.imports module to help test stages 2023-11-07 15:12:08 +01:00