Skip to content

Commit 0dcfc73

Browse files
committed
Add an option to show commands that produced no output as "not tested"
1 parent 567b2bf commit 0dcfc73

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

tests/e2e_tests.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ def get_cli_args():
6161
required=False,
6262
help="Display errors from commands",
6363
)
64+
parser.add_argument(
65+
"--not-tested",
66+
action="store_true",
67+
required=False,
68+
help="Display commands that didn't get tested",
69+
)
6470
parser.add_argument(
6571
"--poetry",
6672
action="store_true",
@@ -189,6 +195,7 @@ def run_e2e_tests(args):
189195
tasks = generate_commands(args)
190196
tasks_len = len(tasks)
191197
failures = []
198+
not_tested_cmds = []
192199

193200
result = subprocess.Popen(
194201
f"{args.executable} --version",
@@ -202,6 +209,7 @@ def run_e2e_tests(args):
202209
start_time = time()
203210
passed = 0
204211
failed = 0
212+
not_tested = 0
205213

206214
while tasks:
207215
task = str(tasks.pop(0))
@@ -232,6 +240,11 @@ def run_e2e_tests(args):
232240
failures.append(task.strip())
233241
failed += 1
234242

243+
# Count the amount of commands that didn't get tested
244+
if not text:
245+
not_tested_cmds.append(task.strip())
246+
not_tested += 1
247+
235248
if args.errors:
236249
raw_text = text.decode("utf-8")
237250
# this is not a good way to detect errors, but it does catch a lot of things
@@ -243,11 +256,16 @@ def run_e2e_tests(args):
243256
# this prints sorta janky, but it does its job
244257
console.log(f"[*] Results:\n{text.decode('utf-8')}")
245258

259+
if not_tested_cmds and args.not_tested:
260+
console.log("[bold yellow]Commands that didn't get tested:")
261+
for not_tested_cmd in not_tested_cmds:
262+
console.log(f"[bold yellow]{not_tested_cmd}")
263+
246264
if failures:
247265
console.log("[bold red]Failed Commands:")
248266
for failure in failures:
249267
console.log(f"[bold red]{failure}")
250-
console.log(f"Ran {tasks_len} tests in {int((time() - start_time) / 60)} mins and {int((time() - start_time) % 60)} seconds - [bold green] Passed: {passed} [bold red] Failed: {failed}")
268+
console.log(f"Ran {tasks_len} tests in {int((time() - start_time) / 60)} mins and {int((time() - start_time) % 60)} seconds - [bold green] Passed: {passed} [bold red] Failed: {failed} [bold yellow] Not Tested: {not_tested}")
251269

252270

253271
if __name__ == "__main__":

0 commit comments

Comments
 (0)