Move some test helper functions into TestCase, and improve testability.

Review Request #11257 — Created Oct. 30, 2020 and submitted

Information

Django Evolution
master

Reviewers

This improves the test capabilities a bit by taking some useful
functions from EvolutionTestCase (assertSQLMappingEqual(),
get_sql_mapping(), and related attriubtes) into TestCase, so that
more unit tests can have access to them.

New utility and assertion functions have been added for unit tests to
use. These include:

  • record_evolutions(): Records new Evolution entries in the
    database.

  • record_applied_migrations(): Records new applied migrations in the
    database.

  • assertEvolutionsEqual(): Asserts that a list of Evolution entries
    match expectations.

  • assertAppliedEvolutions(): Asserts that a list of applied
    Evolution entries match expectations.

  • assertAppliedMigrations(): Asserts that a list of applied migrations
    match expectations.

And finally, upon teardown of a unit test, the built-in test apps are
now deleted from the database and unregistered from Django.

Unit tests pass on all versions of Python.

Summary ID
Move some test helper functions into TestCase, and improve testability.
This improves the test capabilities a bit by taking some useful functions from `EvolutionTestCase` (`assertSQLMappingEqual()`, `get_sql_mapping()`, and related attriubtes) into `TestCase`, so that more unit tests can have access to them. New utility and assertion functions have been added for unit tests to use. These include: * `record_evolutions()`: Records new `Evolution` entries in the database. * `record_applied_migrations()`: Records new applied migrations in the database. * `assertEvolutionsEqual()`: Asserts that a list of `Evolution` entries match expectations. * `assertAppliedEvolutions()`: Asserts that a list of applied `Evolution` entries match expectations. * `assertAppliedMigrations()`: Asserts that a list of applied migrations match expectations. And finally, upon teardown of a unit test, the built-in test apps are now deleted from the database and unregistered from Django.
2d4de4c31d515a2f70b7fd401dd2563d70d20b91
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to master (fb82e74)