From 6feb75129f42fdac751d0b79a2a005b4c0ad5c2d Mon Sep 17 00:00:00 2001 From: Juan Catalano Date: Fri, 6 Sep 2013 20:23:25 -0300 Subject: Fixed #21060 -- Refactored admin's autodiscover method to make it reusable. We want to be able to use it for instance for discovering `tasks.py` modules inside the INSTALLED_APPS. This commit therefore moves the logic to `autodiscover_modules` method in django.utils.module_loading. --- tests/utils_tests/test_module/__init__.py | 3 +++ tests/utils_tests/test_module/another_bad_module.py | 8 ++++++++ tests/utils_tests/test_module/another_good_module.py | 1 + 3 files changed, 12 insertions(+) create mode 100644 tests/utils_tests/test_module/another_bad_module.py create mode 100644 tests/utils_tests/test_module/another_good_module.py (limited to 'tests/utils_tests/test_module') diff --git a/tests/utils_tests/test_module/__init__.py b/tests/utils_tests/test_module/__init__.py index e69de29bb2..8f33921eb6 100644 --- a/tests/utils_tests/test_module/__init__.py +++ b/tests/utils_tests/test_module/__init__.py @@ -0,0 +1,3 @@ +class SiteMock(object): + _registry = {} +site = SiteMock() diff --git a/tests/utils_tests/test_module/another_bad_module.py b/tests/utils_tests/test_module/another_bad_module.py new file mode 100644 index 0000000000..eac25c4aa5 --- /dev/null +++ b/tests/utils_tests/test_module/another_bad_module.py @@ -0,0 +1,8 @@ +from . import site +content = 'Another Bad Module' + +site._registry.update({ + 'foo': 'bar', +}) + +raise Exception('Some random exception.') diff --git a/tests/utils_tests/test_module/another_good_module.py b/tests/utils_tests/test_module/another_good_module.py new file mode 100644 index 0000000000..ed4b2d34a2 --- /dev/null +++ b/tests/utils_tests/test_module/another_good_module.py @@ -0,0 +1 @@ +content = 'Another Good Module' -- cgit v1.3