Skip to content

Commit fae85d5

Browse files
committed
[bfops/fix-list-tests]: print any failed
1 parent db51dc7 commit fae85d5

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

smoketests/__main__.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import tempfile
1616
from pathlib import Path
1717
import shutil
18+
import traceback
1819

1920
def check_docker():
2021
docker_ps = smoketests.run_cmd("docker", "ps", "--format=json")
@@ -116,11 +117,22 @@ def main():
116117

117118
tests = loader.loadTestsFromNames(testlist)
118119
if args.list:
119-
print("Selected tests:\n")
120+
failed_cls = getattr(unittest.loader, "_FailedTest", None)
121+
any_failed = False
120122
for test in _iter_all_tests(tests):
121123
name = test.id()
122-
print(f"{name}")
123-
exit(0)
124+
if isinstance(test, failed_cls):
125+
any_failed = True
126+
print('')
127+
print("Failed to construct %s:" % test.id())
128+
exc = getattr(test, "_exception", None)
129+
if exc is not None:
130+
tb = ''.join(traceback.format_exception(exc))
131+
print(tb.rstrip())
132+
print('')
133+
else:
134+
print(f"{name}")
135+
exit(1 if any_failed else 0)
124136

125137
if not args.no_build_cli:
126138
logging.info("Compiling spacetime cli...")

0 commit comments

Comments
 (0)