You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/en/getting-started.rst
+51Lines changed: 51 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -153,6 +153,57 @@ Once you develop multiple tests, you may want to group them into a class. pytest
153
153
154
154
The first test passed and the second failed. You can easily see the intermediate values in the assertion to help you understand the reason for the failure.
155
155
156
+
Grouping tests in classes can be beneficial for the following reasons:
157
+
158
+
* Test organization
159
+
* Sharing fixtures for tests only in that particular class
160
+
* Applying marks at the class level and having them implicitly apply to all tests
161
+
162
+
Something to be aware of when grouping tests inside classes is that each test has a unique instance of the class.
163
+
Having each test share the same class instance would be very detrimental to test isolation and would promote poor test practices.
0 commit comments