Use ExtensionTestCaseMixin instead of ExtensionTestsMixin in tests.
Review Request #11927 — Created Jan. 11, 2022 and submitted
This updates the entire Djblets test suite to use
ExtensionTestCaseMixin
for unit tests that need to work with
extensions, instead ofExtensionTestsMixin
. The former is the public
interface we provide for testing capabilities, while the latter was an
in-house, hacky, outdated, and leaky mixin used by the bulk of (but not
all of) our tests.The main reason for this change has to do with extension state leaks.
When moving topytest
, the Python 3.10 unit tests were failing due to
an extension not having the right state when a unit test was tearing
down.The reason behind this is that extensions and extension managers weren't
being cleaned up properly. Many tests were creationg extension managers
that never got cleaned up. Since we use weak references for extension
managers, it's possible that the old test runner was allowing them to
clear in some of the cases, but the new one wasn't. Still, the logic
wasn't reliable, and this actually influenced the behavior of some of
our tests.The modern mixin handles cleanup properly, and gives us some utilities
for managing extension scan state, simplifying some unit tests.The old classes are still around, but will go through a deprecation
process. This is because we actually used to use the old classes for
extension unit tests, and before I rip it out, I want to make sure we
aren't still doing that anywhere.
All unit tests pass on all supported versions of Python and Django.
Summary | ID |
---|---|
6bd3f07f0ef696eb47f66d083d697e53d58a8441 |
Description | From | Last Updated |
---|---|---|
E501 line too long (80 > 79 characters) |
reviewbot |
- Change Summary:
-
Updated the new extension middleware tests to use the new mixin.
- Commits:
-
Summary ID 952a7d29786d587f98da170fdb99732d30063194 6bd3f07f0ef696eb47f66d083d697e53d58a8441 - Diff:
-
Revision 2 (+716 -626)