Skip to content

Commit af5fca7

Browse files
authored
more verbose output for failing exploit tests (closes #20) (#24)
* more verbose output for failing exploit tests (closes #20) * bump version to 0.7.0
1 parent 21b255f commit af5fca7

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

enochecker_test/tests.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -556,32 +556,33 @@ def _do_exploit_run(round_id, exploit_id, flag_id, service_address, checker_url)
556556
checker_url,
557557
)
558558
print(found_flag)
559-
return found_flag == flag
560-
except:
561-
pass
562-
return False
559+
return found_flag == flag, None
560+
except Exception as e:
561+
return False, e
563562

564563

565564
def test_exploit_per_exploit_id(
566565
round_id, exploit_id, flag_variants, service_address, checker_url
567566
):
568-
assert any(
569-
[
570-
_do_exploit_run(round_id, exploit_id, flag_id, service_address, checker_url)
571-
for flag_id in range(flag_variants)
572-
]
573-
)
567+
results = [
568+
_do_exploit_run(round_id, exploit_id, flag_id, service_address, checker_url)
569+
for flag_id in range(flag_variants)
570+
]
571+
if any(r[0] for r in results):
572+
return
573+
raise Exception([r[1] for r in results])
574574

575575

576576
def test_exploit_per_flag_id(
577577
round_id, exploit_variants, flag_id, service_address, checker_url
578578
):
579-
assert any(
580-
[
581-
_do_exploit_run(round_id, exploit_id, flag_id, service_address, checker_url)
582-
for exploit_id in range(exploit_variants)
583-
]
584-
)
579+
results = [
580+
_do_exploit_run(round_id, exploit_id, flag_id, service_address, checker_url)
581+
for exploit_id in range(exploit_variants)
582+
]
583+
if any(r[0] for r in results):
584+
return
585+
raise Exception([r[1] for r in results])
585586

586587

587588
def test_exploit_invalid_variant(

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
setuptools.setup(
1111
name="enochecker_test",
12-
version="0.6.1",
12+
version="0.7.0",
1313
author="ldruschk",
1414
author_email="[email protected]",
1515
description="Library to help testing checker scripts based on enochecker",

0 commit comments

Comments
 (0)