File: index.rst

package info (click to toggle)
pytest-subprocess 1.5.3-1~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 444 kB
  • sloc: python: 2,319; makefile: 17
file content (48 lines) | stat: -rw-r--r-- 1,028 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
.. pytest-subprocess documentation master file, created by
   sphinx-quickstart on Sat Nov 23 13:49:07 2019.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

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.

.. code-block:: python

    def test_process(fp):
        fp.register(["fake-command"])
        process = subprocess.run(["fake-command"])

        assert process.returncode == 0


Table of contents
-----------------

.. toctree::
   :maxdepth: 2

   usage
   api
   history



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`


.. _`pip`: https://pypi.org/project/pip/
.. _`PyPI`: https://pypi.org/project