Start on testing infra for command to JSON serialization

This commit is contained in:
Kovid Goyal
2022-08-17 22:37:03 +05:30
parent 47feb73cdf
commit 417c8887b9
5 changed files with 57 additions and 7 deletions

View File

@@ -113,7 +113,11 @@ def create_go_filter(packages: List[str], *names: str) -> str:
if not go:
return ''
all_tests = set()
for line in subprocess.check_output(f'{go} test -list .'.split() + packages).decode().splitlines():
try:
lines = subprocess.check_output(f'{go} test -list .'.split() + packages).decode().splitlines()
except subprocess.CalledProcessError as e:
raise SystemExit(e.returncode)
for line in lines:
if line.startswith('Test'):
all_tests.add(line[4:])
tests = set(names) & all_tests