mirror of
https://github.com/django/django.git
synced 2025-07-05 18:29:11 +00:00
[gsoc2009-testing] RollbackImporter has proven to be a poor match for djangos loading system, removing
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/test-improvements@11297 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
e9802185b4
commit
6d0668359f
@ -1,19 +0,0 @@
|
|||||||
class RollbackImporter:
|
|
||||||
def __init__(self):
|
|
||||||
"Creates an instance and installs as the global importer"
|
|
||||||
self.previousModules = sys.modules.copy()
|
|
||||||
self.realImport = __builtin__.__import__
|
|
||||||
__builtin__.__import__ = self._import
|
|
||||||
self.newModules = {}
|
|
||||||
|
|
||||||
def _import(self, name, globals=None, locals=None, fromlist=[]):
|
|
||||||
result = apply(self.realImport, (name, globals, locals, fromlist))
|
|
||||||
self.newModules[name] = 1
|
|
||||||
return result
|
|
||||||
|
|
||||||
def uninstall(self):
|
|
||||||
for modname in self.newModules.keys():
|
|
||||||
if not self.previousModules.has_key(modname):
|
|
||||||
# Force reload when modname next imported
|
|
||||||
del(sys.modules[modname])
|
|
||||||
__builtin__.__import__ = self.realImport
|
|
Loading…
x
Reference in New Issue
Block a user