|
| 1 | +"""Test the included examples. |
| 2 | +""" |
| 3 | + |
| 4 | +import pytest |
| 5 | +from conftest import get_example |
| 6 | + |
| 7 | + |
| 8 | +def test_debugging(ctestdir): |
| 9 | + """Debugging example |
| 10 | + """ |
| 11 | + with get_example("debugging.py").open("rt") as f: |
| 12 | + ctestdir.makepyfile(f.read()) |
| 13 | + result = ctestdir.runpytest("--verbose") |
| 14 | + try: |
| 15 | + result.assert_outcomes(passed=12, skipped=11, failed=0, xfailed=2) |
| 16 | + except TypeError: |
| 17 | + result.assert_outcomes(passed=12, skipped=11, failed=0) |
| 18 | + result.stdout.re_match_lines(r""" |
| 19 | + .*::test_a (?:XFAIL(?:\s+\(.*\))?|xfail) |
| 20 | + .*::test_b PASSED |
| 21 | + .*::test_c SKIPPED(?:\s+\(.*\))? |
| 22 | + .*::test_d PASSED |
| 23 | + .*::test_e SKIPPED(?:\s+\(.*\))? |
| 24 | + .*::TestClass::test_a PASSED |
| 25 | + .*::TestClass::test_b (?:XFAIL(?:\s+\(.*\))?|xfail) |
| 26 | + .*::TestClass::test_c PASSED |
| 27 | + .*::test_colors\[RED\] PASSED |
| 28 | + .*::test_colors\[GREEN\] PASSED |
| 29 | + .*::test_colors\[BLUE\] PASSED |
| 30 | + .*::test_multicolored SKIPPED(?:\s+\(.*\))? |
| 31 | + .*::test_alert SKIPPED(?:\s+\(.*\))? |
| 32 | + .*::test_g SKIPPED(?:\s+\(.*\))? |
| 33 | + .*::test_h PASSED |
| 34 | + .*::test_k SKIPPED(?:\s+\(.*\))? |
| 35 | + .*::test_l\[0\] PASSED |
| 36 | + .*::test_q\[0\] SKIPPED(?:\s+\(.*\))? |
| 37 | + .*::test_l\[1\] PASSED |
| 38 | + .*::test_q\[1\] SKIPPED(?:\s+\(.*\))? |
| 39 | + .*::test_m SKIPPED(?:\s+\(.*\))? |
| 40 | + .*::test_o SKIPPED(?:\s+\(.*\))? |
| 41 | + .*::test_p PASSED |
| 42 | + .*::test_r PASSED |
| 43 | + .*::test_s SKIPPED(?:\s+\(.*\))? |
| 44 | + """) |
0 commit comments