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
(or fp
for short) fixture to
register commands and specify their behavior before they will be executed.
This will prevent a real subprocess execution.
def test_process(fp):
fp.register(["fake-command"])
process = subprocess.run(["fake-command"])
assert process.returncode == 0
Table of contents#
- Usage
- API Reference
- History
- unreleased (2023-10-01)
- 1.5.0 (2023-01-28)
- 1.4.2 (2022-10-02)
- 1.4.1 (2022-02-09)
- 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)