@@ -72,7 +72,25 @@ def test_01_current_time_set(fprime_test_api: IntegrationTestAPI):
7272 pytest .approx (event_time , abs = 30 ) == datetime .now (timezone .utc )
7373
7474
75- def test_02_set_time_in_past (fprime_test_api : IntegrationTestAPI ):
75+ def test_02_time_incrementing (fprime_test_api : IntegrationTestAPI ):
76+ """Test that time increments over time"""
77+
78+ # Fetch initial time
79+ initial_event_time = get_time (fprime_test_api )
80+
81+ # Wait for time to increment
82+ time .sleep (2.0 )
83+
84+ # Fetch updated time
85+ updated_event_time = get_time (fprime_test_api )
86+
87+ # Assert time has increased
88+ assert updated_event_time > initial_event_time , (
89+ f"Time should increase. Initial: { initial_event_time } , Updated: { updated_event_time } "
90+ )
91+
92+
93+ def test_03_set_time_in_past (fprime_test_api : IntegrationTestAPI ):
7694 """Test that we can set the time to a past time"""
7795
7896 # Set time to Curiosity landing on Mars (7 minutes of terror! https://youtu.be/Ki_Af_o9Q9s)
@@ -90,34 +108,17 @@ def test_02_set_time_in_past(fprime_test_api: IntegrationTestAPI):
90108 event_previous_time_arg .val , tz = timezone .utc
91109 )
92110
111+ # Fetch FPrime time from event
112+ fp_time : TimeType = result .get_time ()
113+ event_time = datetime .fromtimestamp (fp_time .seconds , tz = timezone .utc )
114+
93115 # Assert previously set time is within 30 seconds of now
94116 pytest .approx (previously_set_time , abs = 30 ) == datetime .now (timezone .utc )
95117
96- # Fetch newly set time from event
97- event_time = get_time (fprime_test_api )
98-
99- # Assert time is within 30 seconds of curiosity landing
118+ # Assert event time is within 30 seconds of curiosity landing
100119 pytest .approx (event_time , abs = 30 ) == curiosity_landing
101120
102121
103- def test_03_time_incrementing (fprime_test_api : IntegrationTestAPI ):
104- """Test that time increments over time"""
105-
106- # Fetch initial time
107- initial_event_time = get_time (fprime_test_api )
108-
109- # Wait for time to increment
110- time .sleep (2.0 )
111-
112- # Fetch updated time
113- updated_event_time = get_time (fprime_test_api )
114-
115- # Assert time has increased
116- assert updated_event_time > initial_event_time , (
117- f"Time should increase. Initial: { initial_event_time } , Updated: { updated_event_time } "
118- )
119-
120-
121122def test_04_time_in_telemetry (fprime_test_api : IntegrationTestAPI ):
122123 """Test that we can get Time telemetry"""
123124
0 commit comments