2 new revisions:
Revision: 6cfa170436de
Author: Pekka Klärck
Date: Thu May 19 02:53:48 2011
Log: typo
http://code.google.com/p/robotframework/source/detail?r=6cfa170436de
Revision: e5e033b03225
Author: Pekka Klärck
Date: Thu May 19 03:43:02 2011
Log: cleaned up importing specified file in order to make the code
easier t...
http://code.google.com/p/robotframework/source/detail?r=e5e033b03225
==============================================================================
Revision: 6cfa170436de
Author: Pekka Klärck
Date: Thu May 19 02:53:48 2011
Log: typo
http://code.google.com/p/robotframework/source/detail?r=6cfa170436de
Modified:
/src/robot/output/pyloggingconf.py
=======================================
--- /src/robot/output/pyloggingconf.py Tue May 17 14:28:11 2011
+++ /src/robot/output/pyloggingconf.py Thu May 19 02:53:48 2011
@@ -15,7 +15,7 @@
"""Module to configure Python's standard `logging` module.
After this module is imported, messages logged with `logging` module
-are, by defaul, propagated to Robot's log file.
+are, by default, propagated to Robot's log file.
"""
import logging
==============================================================================
Revision: e5e033b03225
Author: Pekka Klärck
Date: Thu May 19 03:43:02 2011
Log: cleaned up importing specified file in order to make the code
easier to reuse to fix issue 822
http://code.google.com/p/robotframework/source/detail?r=e5e033b03225
Modified:
/src/robot/utils/importing.py
=======================================
--- /src/robot/utils/importing.py Fri Apr 15 14:27:57 2011
+++ /src/robot/utils/importing.py Thu May 19 03:43:02 2011
@@ -26,18 +26,25 @@
err_prefix = "Importing '%s' failed: " % path_to_module
if not os.path.exists(path_to_module):
raise DataError(err_prefix + 'File does not exist')
- moddir, modname = _split_path_to_module(path_to_module)
try:
- try:
- module = __import__(modname)
- if normpath(moddir) !=
normpath(os.path.dirname(module.__file__)):
- del sys.modules[modname]
- module = __import__(modname)
- except:
- raise DataError(err_prefix + get_error_message())
+ return _import_module_by_path(path_to_module)
+ except:
+ raise DataError(err_prefix + get_error_message())
+
+def _import_module_by_path(path):
+ moddir, modname = _split_path_to_module(path)
+ if modname in sys.modules:
+ del sys.modules[modname]
+ sys.path.insert(0, moddir)
+ try:
+ return __import__(modname)
finally:
sys.path.pop(0)
- return module
+
+def _split_path_to_module(path):
+ moddir, modfile = os.path.split(abspath(path))
+ modname = os.path.splitext(modfile)[0]
+ return moddir, modname
def import_(name, type_='test library'):
@@ -73,12 +80,6 @@
return code, source
-def _split_path_to_module(path):
- moddir, modfile = os.path.split(abspath(path))
- modname = os.path.splitext(modfile)[0]
- sys.path.insert(0, moddir)
- return moddir, modname
-
def _import(name, type_):
modname, classname, fromlist = _get_import_params(name)
try: