Skip to content

Commit ab0175f

Browse files
committed
Fix test that fails on specific macos
1 parent 5bf9f29 commit ab0175f

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

tests/utest/robot_interface/test_time_conversions.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
from datetime import timedelta
12
from unittest import TestCase
23

4+
from mock import patch
5+
36
from oxygen.robot_interface import RobotInterface
47

58

@@ -29,22 +32,22 @@ def test_should_be_associative(self):
2932
timestamp = self.interface.result.ms_to_timestamp(milliseconds)
3033
self.assertEqual(timestamp, '20180807 07:01:24.300000')
3134

32-
def _validate_timestamp(self, result):
33-
timestamp = result.ms_to_timestamp(-10)
35+
def _validate_timestamp(self, interface):
36+
timestamp = interface.ms_to_timestamp(-10)
3437
expected = '19700101 00:00:00.990000'
35-
import platform
36-
# Particular Windows 10 calculates epoch differently ( T ʖ̯ T)
37-
if platform.system() == 'Windows' and platform.version() == '10.0.19044':
38-
expected = '19700101 02:00:00.990000'
3938

4039
self.assertEqual(timestamp, expected)
4140

4241
def test_ms_before_epoch_are_reset_to_epoch(self):
4342
from oxygen.robot4_interface import RobotResultInterface as RF4ResultIface
44-
self._validate_timestamp(RF4ResultIface())
43+
with patch.object(RF4ResultIface, 'get_timezone_delta') as m:
44+
m.return_value = timedelta(seconds=7200)
45+
self._validate_timestamp(RF4ResultIface())
4546

4647
from oxygen.robot3_interface import RobotResultInterface as RF3ResultIface
47-
self._validate_timestamp(RF3ResultIface())
48+
with patch.object(RF3ResultIface, 'get_timezone_delta') as m:
49+
m.return_value = timedelta(seconds=7200)
50+
self._validate_timestamp(RF3ResultIface())
4851

4952

5053
class TestTimestampToMs(TestCase):

0 commit comments

Comments
 (0)