27
27
import uuid
28
28
from contextlib import redirect_stdout
29
29
from datetime import datetime
30
+ from datetime import timezone as tz
30
31
from pathlib import Path
31
32
from unittest import mock
32
33
from unittest import skipIf
@@ -754,11 +755,11 @@ def test_scanpipe_run_model_task_execution_time_property(self):
754
755
755
756
self .assertIsNone (run1 .execution_time )
756
757
757
- run1 .task_start_date = datetime (1984 , 10 , 10 , 10 , 10 , 10 , tzinfo = timezone .utc )
758
+ run1 .task_start_date = datetime (1984 , 10 , 10 , 10 , 10 , 10 , tzinfo = tz .utc )
758
759
run1 .save ()
759
760
self .assertIsNone (run1 .execution_time )
760
761
761
- run1 .task_end_date = datetime (1984 , 10 , 10 , 10 , 10 , 35 , tzinfo = timezone .utc )
762
+ run1 .task_end_date = datetime (1984 , 10 , 10 , 10 , 10 , 35 , tzinfo = tz .utc )
762
763
run1 .save ()
763
764
self .assertEqual (25.0 , run1 .execution_time )
764
765
@@ -771,19 +772,19 @@ def test_scanpipe_run_model_execution_time_for_display_property(self):
771
772
772
773
self .assertIsNone (run1 .execution_time_for_display )
773
774
774
- run1 .task_start_date = datetime (1984 , 10 , 10 , 10 , 10 , 10 , tzinfo = timezone .utc )
775
+ run1 .task_start_date = datetime (1984 , 10 , 10 , 10 , 10 , 10 , tzinfo = tz .utc )
775
776
run1 .save ()
776
777
self .assertIsNone (run1 .execution_time_for_display )
777
778
778
- run1 .task_end_date = datetime (1984 , 10 , 10 , 10 , 10 , 35 , tzinfo = timezone .utc )
779
+ run1 .task_end_date = datetime (1984 , 10 , 10 , 10 , 10 , 35 , tzinfo = tz .utc )
779
780
run1 .save ()
780
781
self .assertEqual ("25 seconds" , run1 .execution_time_for_display )
781
782
782
- run1 .task_end_date = datetime (1984 , 10 , 10 , 10 , 12 , 35 , tzinfo = timezone .utc )
783
+ run1 .task_end_date = datetime (1984 , 10 , 10 , 10 , 12 , 35 , tzinfo = tz .utc )
783
784
run1 .save ()
784
785
self .assertEqual ("145 seconds (2.4 minutes)" , run1 .execution_time_for_display )
785
786
786
- run1 .task_end_date = datetime (1984 , 10 , 10 , 11 , 12 , 35 , tzinfo = timezone .utc )
787
+ run1 .task_end_date = datetime (1984 , 10 , 10 , 11 , 12 , 35 , tzinfo = tz .utc )
787
788
run1 .save ()
788
789
self .assertEqual ("3745 seconds (1.0 hours)" , run1 .execution_time_for_display )
789
790
0 commit comments