Revision: 4059
Author: pekka.klarck
Date: Tue Sep  7 13:43:37 2010
Log: elapsed time can be either int or long nowadays
http://code.google.com/p/robotframework/source/detail?r=4059

Modified:
 /trunk/atest/testresources/listeners/attributeverifyinglistener.py
 /trunk/src/robot/utils/robottime.py

=======================================
--- /trunk/atest/testresources/listeners/attributeverifyinglistener.py Mon Mar 29 01:17:03 2010 +++ /trunk/atest/testresources/listeners/attributeverifyinglistener.py Tue Sep 7 13:43:37 2010
@@ -7,7 +7,7 @@

 START_ATTRIBUTES = ['doc', 'starttime']
 END_ATTRIBUTES = START_ATTRIBUTES + ['endtime', 'elapsedtime', 'status']
-EXPECTED_TYPES = {'elapsedtime': long, 'tags': list, 'args': list,
+EXPECTED_TYPES = {'elapsedtime': (int, long), 'tags': list, 'args': list,
                   'metadata': dict, 'tests': list, 'suites': list,
                   'totaltests': int}

@@ -39,9 +39,13 @@
         OUTFILE.write('Expected: %s\nActual: %s\n' % (names, attrs.keys()))
         return
     for name in names:
- status = isinstance(attrs[name], EXPECTED_TYPES.get(name, basestring))\
-                and 'PASSED' or 'FAILED'
-        OUTFILE.write('%s | %s: %s\n' %(status, name, attrs[name]))
+        value = attrs[name]
+        exp_type = EXPECTED_TYPES.get(name, basestring)
+        if isinstance(value, exp_type):
+            OUTFILE.write('PASSED | %s: %s\n' % (name, value))
+        else:
+            OUTFILE.write('FAILED | %s: %r, Expected: %s, Actual: %s\n'
+                          % (name, value, type(value), exp_type))

 def close():
     OUTFILE.close()
=======================================
--- /trunk/src/robot/utils/robottime.py Tue Sep  7 13:09:05 2010
+++ /trunk/src/robot/utils/robottime.py Tue Sep  7 13:43:37 2010
@@ -302,7 +302,8 @@
         end_time = get_timestamp(*seps)
     start_millis = _timestamp_to_millis(start_time, seps)
     end_millis = _timestamp_to_millis(end_time, seps)
-    return end_millis - start_millis
+    # start/end_millis can be long but we want to return int when possible
+    return int(end_millis - start_millis)


 def elapsed_time_to_string(elapsed_millis):

Reply via email to