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: CONTRIBUTING.rst
+41Lines changed: 41 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -280,6 +280,47 @@ Here is a simple overview, with pytest-specific bits:
280
280
base: features # if it's a feature
281
281
282
282
283
+
Writing Tests
284
+
----------------------------
285
+
286
+
Writing tests for plugins or for pytest itself is often done using the `testdir fixture <https://docs.pytest.org/en/latest/reference.html#testdir>`_, as a "black-box" test.
287
+
288
+
For example, to ensure a simple test passes you can write:
289
+
290
+
.. code-block:: python
291
+
292
+
deftest_true_assertion(testdir):
293
+
testdir.makepyfile(
294
+
"""
295
+
def test_foo():
296
+
assert True
297
+
"""
298
+
)
299
+
result = testdir.runpytest()
300
+
result.assert_outcomes(failed=0, passed=1)
301
+
302
+
303
+
Alternatively, it is possible to make checks based on the actual output of the termal using
0 commit comments