Revision: 3324
Author: pekka.klarck
Date: Wed May 19 01:37:06 2010
Log: initfile for dirs, sentence ending dots, whitespace
http://code.google.com/p/robotframework/source/detail?r=3324

Modified:
 /trunk/src/robot/parsing/datareader.py
 /trunk/src/robot/parsing/newmodel.py

=======================================
--- /trunk/src/robot/parsing/datareader.py      Wed May 19 01:02:43 2010
+++ /trunk/src/robot/parsing/datareader.py      Wed May 19 01:37:06 2010
@@ -38,7 +38,7 @@
 class FileReader(object):

     def read(self, path, datafile):
-        LOGGER.info("Parsing test case file '%s'" % path)
+        LOGGER.info("Parsing test case file '%s'." % path)
         source = self._open(path)
         try:
self._get_reader(path).read(source, TestDataPopulator(datafile))
@@ -58,7 +58,7 @@
         try:
             return READERS[extension]()
         except KeyError:
- raise DataError("No reader found for extension '%s'" % extension) + raise DataError("No reader found for extension '%s'." % extension)


 class DirectoryReader(object):
@@ -67,10 +67,11 @@

     def read(self, path, datadir):
         LOGGER.info("Parsing test data directory '%s'" % path)
-        init, children = self._get_children(path)
-        if init:
+        initfile, children = self._get_children(path)
+        datadir.initfile = initfile
+        if initfile:
             try:
-                FileReader().read(init, datadir)
+                FileReader().read(initfile, datadir)
             except DataError, err:
                 # TODO: Reverse control?
                 LOGGER.error(unicode(err))
@@ -82,19 +83,19 @@
                             % (path, unicode(err)))

     def _get_children(self, dirpath):
-        init = None
+        initfile = None
         children = []
         for name, path in self._list_dir(dirpath):
             if self._is_init_file(name, path):
-                if not init:
-                    init = path
+                if not initfile:
+                    initfile = path
                 else:
- LOGGER.error("Ignoring second test suite init file '%s'" % path) + LOGGER.error("Ignoring second test suite init file '%s'." % path)
             elif self._is_ignored(name, path):
-                LOGGER.info("Ignoring file or directory '%s'" % name)
+                LOGGER.info("Ignoring file or directory '%s'." % name)
             else:
                 children.append(path)
-        return init, children
+        return initfile, children

     def _list_dir(self, path):
         # os.listdir returns Unicode entries when path is Unicode
=======================================
--- /trunk/src/robot/parsing/newmodel.py        Tue May 18 07:14:11 2010
+++ /trunk/src/robot/parsing/newmodel.py        Wed May 19 01:37:06 2010
@@ -17,7 +17,7 @@
 from robot.errors import DataError
 from robot.variables import is_var

-from settings import (Documentation, Fixture, Timeout, Tags, Metadata,
+from settings import (Documentation, Fixture, Timeout, Tags, Metadata,
                       Library, Resource, Variables, Arguments, Return)
 from datareader import FileReader, DirectoryReader

@@ -49,6 +49,7 @@

     def __init__(self, source=None):
         self.source = source
+        self.initfile = None
         self.setting_table = SettingTable()
         self.variable_table = VariableTable()
self.testcase_table = TestCaseTableNotAllowed('test suite init file')
@@ -149,11 +150,11 @@
 class TestCaseTableNotAllowed(object):

     def __init__(self, where):
-        self.message = 'Test case table not allowed in ' + where
+        self.message = 'Test case table not allowed in %s.' % where

     def __getattr__(self, name):
         raise DataError(self.message)
-
+

 class Variable(object):

Reply via email to