File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,8 @@ Execute the test function with “quiet” reporting mode:
115
115
Group multiple tests in a class
116
116
--------------------------------------------------------------
117
117
118
+ .. regendoc:wipe
119
+
118
120
Once you develop multiple tests, you may want to group them into a class. pytest makes it easy to create a class containing more than one test:
119
121
120
122
.. code-block :: python
@@ -163,8 +165,11 @@ Something to be aware of when grouping tests inside classes is that each test ha
163
165
Having each test share the same class instance would be very detrimental to test isolation and would promote poor test practices.
164
166
This is outlined below:
165
167
168
+ .. regendoc:wipe
169
+
166
170
.. code-block :: python
167
171
172
+ # content of test_class_demo.py
168
173
class TestClassDemoInstance :
169
174
def test_one (self ):
170
175
assert 0
You can’t perform that action at this time.
0 commit comments