Author: laukpe
Date: Tue Nov 25 10:55:16 2008
New Revision: 1113

Modified:
   trunk/src/robot/output/readers.py
   trunk/src/robot/parsing/model.py
   trunk/src/robot/parsing/rawdata.py

Log:
cleanup, check that data files exists before trying to open them

Modified: trunk/src/robot/output/readers.py
==============================================================================
--- trunk/src/robot/output/readers.py   (original)
+++ trunk/src/robot/output/readers.py   Tue Nov 25 10:55:16 2008
@@ -21,8 +21,8 @@


 def process_outputs(paths, settings, syslog=None):
-    if len(paths) == 0:
-        raise DataError('No Robot output files given.')
+    if not paths:
+        raise DataError('No output files given.')
     if len(paths) == 1:
         return process_output(paths[0], syslog)
testsuite = CombinedTestSuite(settings['StartTime'], settings['EndTime'])

Modified: trunk/src/robot/parsing/model.py
==============================================================================
--- trunk/src/robot/parsing/model.py    (original)
+++ trunk/src/robot/parsing/model.py    Tue Nov 25 10:55:16 2008
@@ -31,8 +31,8 @@

 def TestSuiteData(datasources, settings, syslog):
     datasources = [ utils.normpath(path) for path in datasources ]
-    if len(datasources) == 0:
-        raise DataError("No Robot data sources given.")
+    if not datasources:
+        raise DataError("No data sources given.")
     elif len(datasources) > 1:
return MultiSourceSuite(datasources, settings['SuiteNames'], syslog)
     elif os.path.isdir(datasources[0]):

Modified: trunk/src/robot/parsing/rawdata.py
==============================================================================
--- trunk/src/robot/parsing/rawdata.py  (original)
+++ trunk/src/robot/parsing/rawdata.py  Tue Nov 25 10:55:16 2008
@@ -45,6 +45,8 @@
     try:
         if utils.is_url(path):
             datafile = urllib.urlopen(path)
+        elif not os.path.isfile(path):
+            raise DataError("Data source '%s' does not exist." % path)
         else:
             datafile = open(path, 'rb')
     except:

Reply via email to