Revision: c8f6753b1f09
Author: Pekka Klärck
Date: Thu May 19 05:39:25 2011
Log: only delete imported module from sys.modules if needed - we even
had a test that module is not reimported if not necessary
http://code.google.com/p/robotframework/source/detail?r=c8f6753b1f09
Modified:
/src/robot/utils/importing.py
=======================================
--- /src/robot/utils/importing.py Thu May 19 04:23:47 2011
+++ /src/robot/utils/importing.py Thu May 19 05:39:25 2011
@@ -34,10 +34,12 @@
def _import_module_by_path(path):
moddir, modname = _split_path_to_module(path)
sys.path.insert(0, moddir)
- if modname in sys.modules:
- del sys.modules[modname]
try:
- return __import__(modname)
+ module = __import__(modname)
+ if normpath(os.path.dirname(module.__file__)) != normpath(moddir):
+ del sys.modules[modname]
+ module = __import__(modname)
+ return module
finally:
sys.path.pop(0)