pytest-subprocess¶
This is a pytest plugin to fake the real subprocess behavior to make your tests more independent.
Example¶
You can use the provided fake_process
fixture to register commands and specify
their behavior before they will be executed. This will prevent a real subprocess
execution.
def test_process(fake_process):
fake_process.register_subprocess(["fake-command"])
process = subprocess.run(["fake-command"])
assert process.returncode == 0
Table of contents¶
- Usage
- API Reference
- History
- 1.4.0 (2022-01-23)
- 1.3.2 (2021-11-07)
- 1.3.1 (2021-11-01)
- 1.3.0 (2021-10-24)
- 1.2.0 (2021-10-09)
- 1.1.2 (2021-07-17)
- 1.1.1 (2021-06-18)
- 1.1.0 (2021-04-18)
- 1.0.1 (2021-03-20)
- 1.0.0 (2020-08-22)
- 0.1.5 (2020-06-19)
- 0.1.4 (2020-04-28)
- 0.1.3 (2020-03-04)
- 0.1.2 (2020-01-17)
- 0.1.1 (2019-11-24)
- 0.1.0 (2019-11-23)