Revision: 3879
Author: janne.t.harkonen
Date: Tue Aug 24 03:42:08 2010
Log: Hardcode stdlib names so that they work also inside jar, added test
http://code.google.com/p/robotframework/source/detail?r=3879
Added:
/trunk/utest/running/test_namespace.py
Modified:
/trunk/src/robot/libraries/__init__.py
/trunk/src/robot/running/namespace.py
=======================================
--- /dev/null
+++ /trunk/utest/running/test_namespace.py Tue Aug 24 03:42:08 2010
@@ -0,0 +1,16 @@
+import unittest
+import os
+import pkgutil
+
+from robot.running import namespace
+from robot import libraries
+from robot.utils.asserts import assert_equals
+
+class TestNamespace(unittest.TestCase):
+
+ def test_standard_library_names(self):
+ module_path = os.path.dirname(libraries.__file__)
+ exp_libs = [m[1] for m in pkgutil.iter_modules([module_path])
+ if not m[1].startswith('Deprecated')]
+ assert_equals(exp_libs, namespace.STDLIB_NAMES)
+
=======================================
--- /trunk/src/robot/libraries/__init__.py Mon May 31 05:21:54 2010
+++ /trunk/src/robot/libraries/__init__.py Tue Aug 24 03:42:08 2010
@@ -12,10 +12,3 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
-import os
-
-
-STDLIB_NAMES = [ name for name, ext
- in [ os.path.splitext(i) for i in
os.listdir(os.path.dirname(__file__)) ]
- if not (name == 'Remote' or name.startswith('_') or ext != '.py') ]
=======================================
--- /trunk/src/robot/running/namespace.py Mon May 31 05:21:54 2010
+++ /trunk/src/robot/running/namespace.py Tue Aug 24 03:42:08 2010
@@ -18,7 +18,6 @@
from robot import utils
from robot.errors import FrameworkError, DataError
-from robot.libraries import STDLIB_NAMES
from robot.variables import GLOBAL_VARIABLES
from robot.common import UserErrorHandler
from robot.output import LOGGER
@@ -30,6 +29,8 @@
from runkwregister import RUN_KW_REGISTER
+STDLIB_NAMES =
['BuiltIn', 'Collections', 'Dialogs', 'Easter', 'OperatingSystem',
+ 'Remote', 'Reserved', 'Screenshot', 'String', 'Telnet']
IMPORTER = Importer()
@@ -112,7 +113,7 @@
def _import_library(self, import_setting, variables):
name = self._get_library_name(import_setting, variables)
- lib = IMPORTER.import_library(name, import_setting.args,
+ lib = IMPORTER.import_library(name, import_setting.args,
import_setting.alias, variables)
if lib.name in self._testlibs:
LOGGER.info("Test library '%s' already imported by suite '%s'"