summaryrefslogtreecommitdiff
path: root/doc/en/usage.rst
diff options
context:
space:
mode:
authorboris <boris@verhovs.ky>2019-08-06 13:25:54 -0700
committerboris <boris@verhovs.ky>2019-08-06 13:25:54 -0700
commit7f90e74e0268721045413ae6e0944685cbcf59da (patch)
tree342637e13480968823b70fd98d597255fa168e13 /doc/en/usage.rst
parentcf7761f91f7b194dd89fae13c356d2d4a4d90d0a (diff)
downloadpytest-7f90e74e0268721045413ae6e0944685cbcf59da.tar.gz
label code blocks
Diffstat (limited to 'doc/en/usage.rst')
-rw-r--r--doc/en/usage.rst6
1 files changed, 6 insertions, 0 deletions
diff --git a/doc/en/usage.rst b/doc/en/usage.rst
index 75f5aacfd..f29e018a1 100644
--- a/doc/en/usage.rst
+++ b/doc/en/usage.rst
@@ -756,16 +756,22 @@ Calling pytest from Python code
You can invoke ``pytest`` from Python code directly::
+.. code-block:: python
+
pytest.main()
this acts as if you would call "pytest" from the command line.
It will not raise ``SystemExit`` but return the exitcode instead.
You can pass in options and arguments::
+.. code-block:: python
+
pytest.main(['-x', 'mytestdir'])
You can specify additional plugins to ``pytest.main``::
+.. code-block:: python
+
# content of myinvoke.py
import pytest
class MyPlugin(object):