| 1 |
import pytest |
| 2 |
|
| 3 |
pytest_plugins = ["tests.optional"] |
| 4 |
|
| 5 |
PRINT_FULL_TREE: bool = False |
| 6 |
PRINT_TREE_DIFF: bool = True |
| 7 |
|
| 8 |
|
| 9 |
def pytest_addoption(parser: pytest.Parser) -> None: |
| 10 |
parser.addoption( |
| 11 |
"--print-full-tree", |
| 12 |
action="store_true", |
| 13 |
default=False, |
| 14 |
help="print full syntax trees on failed tests", |
| 15 |
) |
| 16 |
parser.addoption( |
| 17 |
"--print-tree-diff", |
| 18 |
action="store_true", |
| 19 |
default=True, |
| 20 |
help="print diff of syntax trees on failed tests", |
| 21 |
) |
| 22 |
|
| 23 |
|
| 24 |
def pytest_configure(config: pytest.Config) -> None: |
| 25 |
global PRINT_FULL_TREE |
| 26 |
global PRINT_TREE_DIFF |
| 27 |
PRINT_FULL_TREE = config.getoption("--print-full-tree") |
| 28 |
PRINT_TREE_DIFF = config.getoption("--print-tree-diff") |