diff options
| author | Tim Graham <timograham@gmail.com> | 2017-01-27 17:39:49 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-27 17:39:49 -0500 |
| commit | 9e9e73735e9aa651b5c8ad7a700f90ccb5d3b18b (patch) | |
| tree | d604a3dedaa2beff0f761b8076973864f05518f9 /tests/utils_tests | |
| parent | b09faa497ee5f7dfe9cd54515cf8d3828960d306 (diff) | |
Refs #23919 -- Removed an obsolete test for a Python 2 code path (refs #15662).
Fixed #21628 by removing the last usage of the imp module.
Diffstat (limited to 'tests/utils_tests')
| -rw-r--r-- | tests/utils_tests/test_module_loading.py | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/tests/utils_tests/test_module_loading.py b/tests/utils_tests/test_module_loading.py index f66c167974..5362c2b06b 100644 --- a/tests/utils_tests/test_module_loading.py +++ b/tests/utils_tests/test_module_loading.py @@ -1,4 +1,3 @@ -import imp import os import sys import unittest @@ -13,11 +12,6 @@ from django.utils.module_loading import ( class DefaultLoader(unittest.TestCase): - def setUp(self): - sys.meta_path.insert(0, ProxyFinder()) - - def tearDown(self): - sys.meta_path.pop(0) def test_loader(self): "Normal module existence can be tested" @@ -178,35 +172,6 @@ class AutodiscoverModulesTestCase(SimpleTestCase): self.assertEqual(site._registry, {'lorem': 'ipsum'}) -class ProxyFinder: - def __init__(self): - self._cache = {} - - def find_module(self, fullname, path=None): - tail = fullname.rsplit('.', 1)[-1] - try: - fd, fn, info = imp.find_module(tail, path) - if fullname in self._cache: - old_fd = self._cache[fullname][0] - if old_fd: - old_fd.close() - self._cache[fullname] = (fd, fn, info) - except ImportError: - return None - else: - return self # this is a loader as well - - def load_module(self, fullname): - if fullname in sys.modules: - return sys.modules[fullname] - fd, fn, info = self._cache[fullname] - try: - return imp.load_module(fullname, fd, fn, info) - finally: - if fd: - fd.close() - - class TestFinder: def __init__(self, *args, **kwargs): self.importer = zipimporter(*args, **kwargs) |
