autowisp.tests.test_suite_registration module

Class Inheritance Diagram

Inheritance diagram of TestSuiteRegistration

Check that the suite runs every test the package defines.

python -m autowisp.tests collects from the names imported into autowisp.tests.__main__, so a test class nobody imports there is simply never run. Nothing reports that: the suite passes, faster than it should, and the tests that were supposed to be guarding something are not. Running one module directly – python -m unittest autowisp.tests.test_x – hides it too, since that bypasses __main__ entirely and the tests do run.

Both ways of getting it wrong have happened: a class added and never registered, a class moved between modules and left importing from the old one (which at least fails loudly), and two classes of the same name in different modules, where importing both puts one in the namespace and silently drops the other.

So this compares what the runner reaches with what the modules define, which is the one check that catches all three.

class autowisp.tests.test_suite_registration.TestSuiteRegistration(methodName='runTest')[source]

Bases: TestCase

Inheritance diagram of autowisp.tests.test_suite_registration.TestSuiteRegistration

The runner reaches every test in the package.

test_every_test_is_registered()[source]

Nothing defined in a test module is missing from __main__.

autowisp.tests.test_suite_registration.collect_ids(suite)[source]

Return {module.Class.method} for every test in suite.

Qualified by module because two modules may define classes of the same name, which is one of the ways a test goes missing: the bare name would make the two look like one and hide exactly that case.