Add real test data for models in unit tests.

Review Request #11382 — Created Jan. 19, 2021 and submitted — Latest diff uploaded

Information

Django Evolution
release-2.x

Reviewers

The test suite operated solely on schema changes, without any data in
the database for those models. This meant that the tests missed some
important things. For instance, on SQLite, Django Evolution 2.0
regressed adding non-NULL fields when there's data in a table, and this
wasn't caught in the tests due to the lack of data.

Now every test suite can inject data into the models prior to mutation,
ensuring that we're operating in a more real-world scenario.

This currently breaks the SQLite tests (revealing the aforementioned
bug), but those will be fixed in an upcoming change.

Unit tests pass except on SQLite (where the bug manifests).

Unit tests pass completely with an upcoming fix.

Diff Revision 1

This is not the most recent revision of the diff. The latest diff is revision 2. See what's changed.

orig
1
2

Commits

First Last Summary ID Author
Add real test data for models in unit tests.
The test suite operated solely on schema changes, without any data in the database for those models. This meant that the tests missed some important things. For instance, on SQLite, Django Evolution 2.0 regressed adding non-NULL fields when there's data in a table, and this wasn't caught in the tests due to the lack of data. Now every test suite can inject data into the models prior to mutation, ensuring that we're operating in a more real-world scenario. This currently breaks the SQLite tests (revealing the aforementioned bug), but those will be fixed in an upcoming change.
619d1c0d18e86dbe5f99769e245a2387c796042d Christian Hammond
django_evolution/tests/base_test_case.py
django_evolution/tests/test_add_field.py
django_evolution/tests/test_change_field.py
django_evolution/tests/test_change_meta.py
django_evolution/tests/test_delete_app.py
django_evolution/tests/test_delete_field.py
django_evolution/tests/test_preprocessing.py
django_evolution/tests/test_rename_field.py
django_evolution/tests/test_sql_mutation.py
django_evolution/tests/db/mysql.py
django_evolution/tests/db/postgresql.py
django_evolution/tests/db/sqlite3.py
Loading...