Add infrastructure to help apps offer extension testing functionality.
Review Request #8290 — Created July 16, 2016 and submitted
This provides some new classes that applications can use to help
extension authors write unit tests for their extensions.There's a new test runner class that handles setting up a Django
environment, configuring basic Djblets settings, and handling static
media collection. This can easily form the base test runner for any
Django applications, not just those with extensions, but it's also
useful for extension test cases.There's also a new mixin for unit test: ExtensionTestCaseMixin. This
makes it easy to get a registered/enabled extension instance for a given
extension class, so that unit tests can be written utilizing that
extension.Documentation has been written on making use of these in a product.
Based on work by Weijie Sun.
Updated Review Board to make use of this and modified Power Pack to use
the new infrastructure. I successfully completed a unit test run.Built the docs and read through them. Tested the code samples.
Description | From | Last Updated |
---|---|---|
Can't this all just be shutil.rmtree(self.tempdir)? |
david |
- Change Summary:
-
- Switched to
shutil.rmtree
. - Acknowledged Weijie Sun in the review request.
- Switched to
- Description:
-
This provides some new classes that applications can use to help
extension authors write unit tests for their extensions. There's a new test runner class that handles setting up a Django
environment, configuring basic Djblets settings, and handling static media collection. This can easily form the base test runner for any Django applications, not just those with extensions, but it's also useful for extension test cases. There's also a new mixin for unit test: ExtensionTestCaseMixin. This
makes it easy to get a registered/enabled extension instance for a given extension class, so that unit tests can be written utilizing that extension. Documentation has been written on making use of these in a product.
+ + Based on work by Weijie Sun.
- Commit:
-
88020d487f9330a926f13180d243b700e5620d01b3e88a7d458367ec20e4839d33bb9bf5a74426a0
-
Tool: PEP8 Style Checker Processed Files: djblets/extensions/testing/testcases.py djblets/testing/testrunners.py djblets/extensions/testing/__init__.py Ignored Files: docs/djblets/guides/extensions/testing-extensions.rst docs/djblets/guides/extensions/index.rst docs/djblets/coderef/index.rst Tool: Pyflakes Processed Files: djblets/extensions/testing/testcases.py djblets/testing/testrunners.py djblets/extensions/testing/__init__.py Ignored Files: docs/djblets/guides/extensions/testing-extensions.rst docs/djblets/guides/extensions/index.rst docs/djblets/coderef/index.rst
- Change Summary:
-
Fixed some reference issues in the Testing Extensions guide.
- Commit:
-
b3e88a7d458367ec20e4839d33bb9bf5a74426a05f4037a24155ec84ee1ec9167951d86d1f782a50
-
Tool: Pyflakes Processed Files: djblets/extensions/testing/testcases.py djblets/testing/testrunners.py djblets/extensions/testing/__init__.py Ignored Files: docs/djblets/guides/extensions/testing-extensions.rst docs/djblets/guides/extensions/index.rst docs/djblets/coderef/index.rst Tool: PEP8 Style Checker Processed Files: djblets/extensions/testing/testcases.py djblets/testing/testrunners.py djblets/extensions/testing/__init__.py Ignored Files: docs/djblets/guides/extensions/testing-extensions.rst docs/djblets/guides/extensions/index.rst docs/djblets/coderef/index.rst