Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
nixosTests: drop nr_tests and failed_tests variables
With the tests now bailing out early on a failing subtest, we don't need
to keep a list of failed tests, or the number of total tests
  • Loading branch information
flokli committed Apr 30, 2020
1 parent b139bc0 commit 3cdd558
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions nixos/lib/test-driver/test-driver.py
Expand Up @@ -85,8 +85,6 @@
}

# Forward references
nr_tests: int
failed_tests: list
log: "Logger"
machines: "List[Machine]"

Expand Down Expand Up @@ -882,25 +880,10 @@ def run_tests() -> None:
if machine.is_up():
machine.execute("sync")

if nr_tests != 0:
nr_succeeded = nr_tests - len(failed_tests)
eprint("{} out of {} tests succeeded".format(nr_succeeded, nr_tests))
if len(failed_tests) > 0:
eprint(
"The following tests have failed:\n - {}".format(
"\n - ".join(failed_tests)
)
)
sys.exit(1)


@contextmanager
def subtest(name: str) -> Iterator[None]:
global nr_tests
global failed_tests

with log.nested(name):
nr_tests += 1
try:
yield
return True
Expand All @@ -926,9 +909,6 @@ def subtest(name: str) -> Iterator[None]:
]
exec("\n".join(machine_eval))

nr_tests = 0
failed_tests = []

@atexit.register
def clean_up() -> None:
with log.nested("cleaning up"):
Expand Down

0 comments on commit 3cdd558

Please sign in to comment.