From ca4c9707a2dd788439d5d46e801323371c5335d6 Mon Sep 17 00:00:00 2001 From: Tattoo Date: Wed, 18 Oct 2023 15:11:24 +0300 Subject: [PATCH] Fix tests --- src/oxygen/robot4_interface.py | 4 ++-- tests/utest/robot_interface/test_time_conversions.py | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/oxygen/robot4_interface.py b/src/oxygen/robot4_interface.py index a8cbc36..a6dbe51 100644 --- a/src/oxygen/robot4_interface.py +++ b/src/oxygen/robot4_interface.py @@ -5,8 +5,6 @@ TestCase as RobotResultTest, TestSuite as RobotResultSuite) -from robot.model import BodyItem - from robot.running.model import TestSuite as RobotRunningSuite @@ -227,6 +225,8 @@ def spawn_robot_keyword(self, start_timestamp = self.ms_to_timestamp(start_time) end_timestamp = self.ms_to_timestamp(end_time) + # import this here so RF4 interface stays in parity with RF3 + from robot.model import BodyItem if setup: keyword_type = BodyItem.SETUP elif teardown: diff --git a/tests/utest/robot_interface/test_time_conversions.py b/tests/utest/robot_interface/test_time_conversions.py index 660c2bb..92d437f 100644 --- a/tests/utest/robot_interface/test_time_conversions.py +++ b/tests/utest/robot_interface/test_time_conversions.py @@ -31,7 +31,15 @@ def test_should_be_associative(self): def _validate_timestamp(self, result): timestamp = result.ms_to_timestamp(-10) - self.assertEqual(timestamp, '19700101 02:00:00.990000') + expected = '19700101 00:00:01.990000' + # Windows 10 calculates epoch differently ( T ʖ̯ T) + import platform + if platform.system() == 'Windows' + expected = '19700101 00:00:00.990000' + if platform.release() == '10': + expected = '19700101 02:00:00.990000' + + self.assertEqual(timestamp, expected) def test_ms_before_epoch_are_reset_to_epoch(self): from oxygen.robot4_interface import RobotResultInterface as RF4ResultIface