change datetime.now to datetime.utcnow;
fix test_ifeed test;
This commit is contained in:
@@ -61,7 +61,7 @@ class Orchestrator:
|
||||
for traffic_light in traffic_lights['cursor']:
|
||||
self.tls[traffic_light['id']] = {'color': traffic_light['color'],
|
||||
'switching_time': traffic_light['switchingTime'],
|
||||
'last_switch': datetime.now()}
|
||||
'last_switch': datetime.utcnow()}
|
||||
|
||||
def setup_msg_queues(self):
|
||||
"""
|
||||
@@ -108,7 +108,7 @@ class Orchestrator:
|
||||
print('Target velocity: {}'.format(target_vel))
|
||||
response_channel.send(pickle.dumps(
|
||||
TargetVelocity(vin=received_daf_object.vehicle_identification_number, target_velocity=target_vel,
|
||||
timestamp=datetime.now())))
|
||||
timestamp=datetime.utcnow())))
|
||||
|
||||
def handle_tl_state_receive(self, msg):
|
||||
"""
|
||||
|
||||
@@ -9,7 +9,7 @@ from orchestrator import Orchestrator
|
||||
|
||||
class TestOrchestrator(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.timestamp = datetime.datetime.now()
|
||||
self.timestamp = datetime.datetime.utcnow()
|
||||
with patch('requests.sessions.Session.get', MyResponse):
|
||||
self.orc = Orchestrator()
|
||||
|
||||
@@ -18,7 +18,18 @@ class TestOrchestrator(unittest.TestCase):
|
||||
tl_geo = {'cursor': [
|
||||
{'id': '1', 'calculatedRange': 1000}
|
||||
]}
|
||||
current_vel = 130.0
|
||||
current_vel = 55.0
|
||||
|
||||
target_vel = self.orc._compute_velocity(tl_geo, current_vel)
|
||||
self.assertEqual(current_vel, target_vel)
|
||||
|
||||
def test_slow_down_if_passing_not_possible(self):
|
||||
self.orc.tls = {'1': {'color': 'RED', 'switching_time': 1, 'last_switch': self.timestamp}}
|
||||
tl_geo = {'cursor': [
|
||||
{'id': '1', 'calculatedRange': 1000}
|
||||
]}
|
||||
current_vel = 50.0
|
||||
|
||||
target_vel = self.orc._compute_velocity(tl_geo, current_vel)
|
||||
self.assertEqual(current_vel, target_vel)
|
||||
print(target_vel)
|
||||
|
||||
Reference in New Issue
Block a user