Add additional checks for baseline signature integrity.

Review Request #11216 — Created Oct. 13, 2020 and submitted — Latest diff uploaded


Django Evolution


Through some debugging and development, I've hit situations in which an
expected model signature could be missing, causing an error far enough
in the process to make the situation hard to debug.

To address this, this change adds some enhanced signature checking in
MockModel, MockMeta, and the base ModelMutator.

The mock support are just assertion checks that stops logic from getting
too far if something goes very wrong.

The ModelMutator checks are more comprehensive. There's no longer an
assumption that a model signature can be returned. It checks, and if one
cannot be found, a suitable exception is raised so that it can be

While here, a fix to a previous exception has been added, fixing a crash
due to a lack of missing exception message.

Unit tests are in place to ensure the exceptions are raised.

Unit tests pass.

Verified this resulted in a much more reasonable error in the sort of
pathological condition I hit.