File: test_indulgent_ordering.py

package info (click to toggle)
pytest-order 1.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 600 kB
  • sloc: python: 3,483; makefile: 159; sh: 13
file content (38 lines) | stat: -rw-r--r-- 1,084 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
def test_run_marker_registered(test_path):
    test_path.makepyfile(
        test_failing=(
            """
            import pytest

            @pytest.mark.order("second")
            def test_me_second():
                assert True

            def test_that_fails():
                assert False

            @pytest.mark.order("first")
            def test_me_first():
                assert True
            """
        )
    )
    result = test_path.runpytest("-v")
    result.assert_outcomes(passed=2, failed=1)
    result.stdout.fnmatch_lines(
        [
            "test_failing.py::test_me_first PASSED",
            "test_failing.py::test_me_second PASSED",
            "test_failing.py::test_that_fails FAILED",
        ]
    )

    result = test_path.runpytest("-v", "--ff", "--indulgent-ordering")
    result.assert_outcomes(passed=2, failed=1)
    result.stdout.fnmatch_lines(
        [
            "test_failing.py::test_that_fails FAILED",
            "test_failing.py::test_me_first PASSED",
            "test_failing.py::test_me_second PASSED",
        ]
    )