Skip to main content

Practice ยท 1 of 1

A runner that tells the truth

Implement run_suite(tests, order=None) โ€” tests are {'name', 'fn'} dicts whose fn() either returns normally or raises: - execution follows order (a list of names) when given, else input order - returns {'passed': [...], 'failed': [...], 'errors': [...], 'skipped': [...]} - AssertionError โ†’ failed; any other exception โ†’ errors (a failing assertion is a test result; a NameError is a broken test) - names in order that match no test โ†’ entries '<name>: no such test' in errors; tests not mentioned in a given order โ†’ skipped The discriminating scenario: a suite where one test raises NameError must report it as an error, not a failure โ€” that distinction is the whole point.

Difficulty: advanced

Back to lesson: Practice: Test Runner Mini-Project