Add Python 3 support for TestModelsLoaderMixin.

Review Request #9725 — Created March 4, 2018 and submitted

Information

Djblets
release-2.0.x
4372d77...

Reviewers

TestModelsLoaderMixin, which helps unit tests temporarily define
models for test purposes, has been updated to create module in a way
that's compatible with Python 3.4 and higher.

Earlier versions only needed to create a ModuleType instance, but 3.4
and higher has a new module creation and import system, where you create
a ModuleSpec defining aspects of the module and then register a model
based on it. This isn't entirely fleshed out on Python 3.4 (creating a
module requires access to private functions), but on 3.5 and higher
there's a public function for this.

With this change, unit tests can successfully register test models under
Python 3.

Unit tests using this mixin pass (when combined with other upcoming changes)
on Python 2.7, 3.4, 3.5, and 3.6.

Description From Last Updated

This looks like it should fit on one line.

daviddavid
chipx86
david
  1. 
      
  2. djblets/testing/testcases.py (Diff revision 1)
     
     
     
    Show all issues

    This looks like it should fit on one line.

    1. Just helps a bit with the readability. This isn't any different than what we typically do when using keyword arguments.

    2. Either way. I usually don't start wrapping one-per-line until it gets bigger than this but that's just a preference.

  3. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.0.x (fe59e0b)