|
1 | 1 | import argparse |
2 | 2 | import os |
3 | 3 | import re |
| 4 | +import sys |
4 | 5 | from pathlib import Path |
5 | 6 | from typing import Optional |
6 | 7 |
|
@@ -44,16 +45,32 @@ def pytest_internalerror(excrepr, excinfo): |
44 | 45 | assert result.ret == ExitCode.INTERNAL_ERROR |
45 | 46 | assert result.stdout.lines[0] == "INTERNALERROR> Traceback (most recent call last):" |
46 | 47 |
|
| 48 | + end_lines = ( |
| 49 | + result.stdout.lines[-4:] |
| 50 | + if sys.version_info >= (3, 11) |
| 51 | + else result.stdout.lines[-3:] |
| 52 | + ) |
| 53 | + |
47 | 54 | if exc == SystemExit: |
48 | | - assert result.stdout.lines[-3:] == [ |
| 55 | + assert end_lines == [ |
49 | 56 | f'INTERNALERROR> File "{c1}", line 4, in pytest_sessionstart', |
50 | 57 | 'INTERNALERROR> raise SystemExit("boom")', |
| 58 | + *( |
| 59 | + ("INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^",) |
| 60 | + if sys.version_info >= (3, 11) |
| 61 | + else () |
| 62 | + ), |
51 | 63 | "INTERNALERROR> SystemExit: boom", |
52 | 64 | ] |
53 | 65 | else: |
54 | | - assert result.stdout.lines[-3:] == [ |
| 66 | + assert end_lines == [ |
55 | 67 | f'INTERNALERROR> File "{c1}", line 4, in pytest_sessionstart', |
56 | 68 | 'INTERNALERROR> raise ValueError("boom")', |
| 69 | + *( |
| 70 | + ("INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^",) |
| 71 | + if sys.version_info >= (3, 11) |
| 72 | + else () |
| 73 | + ), |
57 | 74 | "INTERNALERROR> ValueError: boom", |
58 | 75 | ] |
59 | 76 | if returncode is False: |
|
0 commit comments