diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index c005c2fb2..eb36122b5 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -280,6 +280,37 @@ Here is a simple overview, with pytest-specific bits: base: features # if it's a feature +Writing Tests +---------------------------- + +Writing tests for plugins or for pytest itself is done using the `testdir fixture `_, + +For example: + +.. code-block:: python + + def test_true_assertion(testdir): + testdir.makepyfile( + """ + def test_foo(): + assert True + """ + ) + result = testdir.runpytest() + result.assert_outcomes(failed=0, passed=1) + + + def test_true_assertion(testdir): + testdir.makepyfile( + """ + def test_foo(): + assert False + """ + ) + result = testdir.runpytest() + result.assert_outcomes(failed=1, passed=0) + + Joining the Development Team ----------------------------