@@ -32,14 +32,16 @@ considered.
32
32
33
33
34
34
Installation
35
- ==================
36
- Install the plugin with::
35
+ ============
36
+ Install the plugin as below.
37
+
38
+ .. code-block :: sh
37
39
38
40
pip install pytest-twisted
39
41
40
42
41
43
Using the plugin
42
- ==================
44
+ ================
43
45
44
46
The plugin is available after installation and can be disabled using
45
47
``-p no:twisted ``.
@@ -66,7 +68,9 @@ inlineCallbacks
66
68
===============
67
69
Using ``twisted.internet.defer.inlineCallbacks `` as a decorator for test
68
70
functions, which use fixtures, does not work. Please use
69
- ``pytest_twisted.inlineCallbacks `` instead::
71
+ ``pytest_twisted.inlineCallbacks `` instead.
72
+
73
+ .. code-block :: python
70
74
71
75
@pytest_twisted.inlineCallbacks
72
76
def test_some_stuff (tmpdir ):
@@ -78,7 +82,9 @@ ensureDeferred
78
82
==============
79
83
Using ``twisted.internet.defer.ensureDeferred `` as a decorator for test
80
84
functions, which use fixtures, does not work. Please use
81
- ``pytest_twisted.ensureDeferred `` instead::
85
+ ``pytest_twisted.ensureDeferred `` instead.
86
+
87
+ .. code-block :: python
82
88
83
89
@pytest_twisted.ensureDeferred
84
90
async def test_some_stuff (tmpdir ):
@@ -88,7 +94,9 @@ functions, which use fixtures, does not work. Please use
88
94
89
95
Waiting for deferreds in fixtures
90
96
=================================
91
- ``pytest_twisted.blockon `` allows fixtures to wait for deferreds::
97
+ ``pytest_twisted.blockon `` allows fixtures to wait for deferreds.
98
+
99
+ .. code-block :: python
92
100
93
101
@pytest.fixture
94
102
def val ():
@@ -101,7 +109,9 @@ async/await fixtures
101
109
====================
102
110
``async ``/``await `` fixtures can be used along with ``yield `` for normal
103
111
pytest fixture semantics of setup, value, and teardown. At present only
104
- function scope is supported::
112
+ function scope is supported.
113
+
114
+ .. code-block :: python
105
115
106
116
@pytest_twisted.async_fixture
107
117
async def foo ():
@@ -118,7 +128,9 @@ The twisted greenlet
118
128
Some libraries (e.g. corotwine) need to know the greenlet, which is
119
129
running the twisted reactor. It's available from the
120
130
``twisted_greenlet `` fixture. The following code can be used to make
121
- corotwine work with pytest-twisted::
131
+ corotwine work with pytest-twisted.
132
+
133
+ .. code-block :: python
122
134
123
135
@pytest.fixture (scope = " session" , autouse = True )
124
136
def set_MAIN (request , twisted_greenlet ):
0 commit comments