Change how patches are imported/applied, and patch during test runs.

Review Request #11993 — Created Jan. 24, 2022 and submitted

Information

Django Evolution
release-2.x

Reviewers

Django Evolution applies patches when starting up, but we weren't doing
this correctly during test runs. This was mostly an issue when testing
under Python 3.10, which has the collections changes that break older
versions of Django.

The test runner now applies patches. However, this unveiled a new
problem: Some patches need to apply before others can be imported,
especially since they import the database layers of Django.

Now, the module managing patch application lazily imports when applying,
rather than importing on module load. This avoids the import issue, and
eases maintenance going forward.

All unit tests pass for all currently supported combinations of Python
and Django.

Summary ID
Change how patches are imported/applied, and patch during test runs.
Django Evolution applies patches when starting up, but we weren't doing this correctly during test runs. This was mostly an issue when testing under Python 3.10, which has the `collections` changes that break older versions of Django. The test runner now applies patches. However, this unveiled a new problem: Some patches need to apply before others can be imported, especially since they import the database layers of Django. Now, the module managing patch application lazily imports when applying, rather than importing on module load. This avoids the import issue, and eases maintenance going forward.
ff9d71076fc345e140423bcf0e279fa536fe6a94
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.x (ee79509)