Support skipping AST printing on test failure

This commit is contained in:
Łukasz Langa 2018-03-20 18:40:20 -07:00
parent d1e0d79e38
commit 591bedc2be

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from functools import partial from functools import partial
from io import StringIO from io import StringIO
import os
from pathlib import Path from pathlib import Path
import sys import sys
from typing import Any, List, Tuple from typing import Any, List, Tuple
@ -47,7 +48,7 @@ class BlackTestCase(unittest.TestCase):
maxDiff = None maxDiff = None
def assertFormatEqual(self, expected: str, actual: str) -> None: def assertFormatEqual(self, expected: str, actual: str) -> None:
if actual != expected: if actual != expected and not os.environ.get('SKIP_AST_PRINT'):
bdv: black.DebugVisitor[Any] bdv: black.DebugVisitor[Any]
black.out('Expected tree:', fg='green') black.out('Expected tree:', fg='green')
try: try: