-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for printing the diff of AST trees when running tests (#3902
) Co-authored-by: Jelle Zijlstra <[email protected]>
- Loading branch information
1 parent
3dcacdd
commit 9b82120
Showing
6 changed files
with
125 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,28 @@ | ||
import pytest | ||
|
||
pytest_plugins = ["tests.optional"] | ||
|
||
PRINT_FULL_TREE: bool = False | ||
PRINT_TREE_DIFF: bool = True | ||
|
||
|
||
def pytest_addoption(parser: pytest.Parser) -> None: | ||
parser.addoption( | ||
"--print-full-tree", | ||
action="store_true", | ||
default=False, | ||
help="print full syntax trees on failed tests", | ||
) | ||
parser.addoption( | ||
"--print-tree-diff", | ||
action="store_true", | ||
default=True, | ||
help="print diff of syntax trees on failed tests", | ||
) | ||
|
||
|
||
def pytest_configure(config: pytest.Config) -> None: | ||
global PRINT_FULL_TREE | ||
global PRINT_TREE_DIFF | ||
PRINT_FULL_TREE = config.getoption("--print-full-tree") | ||
PRINT_TREE_DIFF = config.getoption("--print-tree-diff") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters