Tool: Pyflakes Processed Files: djblets/avatars/tests.py djblets/testing/decorators.py Tool: PEP8 Style Checker Processed Files: djblets/avatars/tests.py djblets/testing/decorators.py
Fix avatar unit tests on django 1.8+
Review Request #8809 — Created March 10, 2017 and submitted
User.get_profileto exist, but Django has
removed this method in modern versions, causing some test failures.
This patch adds a testcase decorator to re-implement the missing
method when it is not present.
Ran unit tests on Django 1.8 and 1.6: they passed!
This should probably say that it will attach only if
User.get_profiledoesn't exist, and state that this is the default on Django 1.7+ unless the consuming app manually adds it.
Let's have this do a comparison to make sure
User.get_profileis the version this function provides. That'll avoid a potential problem where an import by the test triggers a code path that adds a project-specific
Tool: PEP8 Style Checker Processed Files: djblets/avatars/tests.py djblets/testing/decorators.py Tool: Pyflakes Processed Files: djblets/avatars/tests.py djblets/testing/decorators.py
On Django 1.8, this is actually raising
NotImplementedErrorin the tests that were failing before.