@@ -23,34 +23,33 @@ def get_outdated_snapshots_for_directory(
2323 """
2424
2525 result = {"date" : date_limit }
26- date_limit = datetime .datetime .strptime (date_limit , "%d-%m-%Y" )
26+ date_limit = datetime .datetime .strptime (date_limit , "%d-%m-%Y" ). timestamp ()
2727 outdated_snapshots = {}
2828
2929 def do_get_outdated_snapshots (path : str ):
30-
3130 if not path .endswith ("/" ):
3231 path = f"{ path } /"
3332 for file in os .listdir (path ):
3433 if os .path .isdir (f"{ path } { file } " ) and check_sub_directories :
3534 do_get_outdated_snapshots (f"{ path } { file } " )
36- elif file .endswith (".snapshot .json" ):
35+ elif file .endswith (".validation .json" ):
3736 with open (f"{ path } { file } " ) as f :
3837 json_content : dict = json .load (f )
3938 for name , recorded_snapshot_data in json_content .items ():
40- recorded_date = recorded_snapshot_data .get ("recorded-date " )
41- date = datetime .datetime .strptime (recorded_date , "%d-%m-%Y, %H:%M:%S" )
42- if date < date_limit :
39+ recorded_date = recorded_snapshot_data .get ("last_validated_date " )
40+ date = datetime .datetime .fromisoformat (recorded_date )
41+ if date . timestamp () < date_limit :
4342 outdated_snapshot_data = dict ()
4443 if show_date :
45- outdated_snapshot_data ["recorded-date " ] = recorded_date
44+ outdated_snapshot_data ["last_validation_date " ] = recorded_date
4645 if combine_parametrized :
4746 # change parametrized tests of the form <mytest[param_value]> to just <mytest>
4847 name = name .split ("[" )[0 ]
4948 outdated_snapshots [name ] = outdated_snapshot_data
5049
5150 do_get_outdated_snapshots (path )
5251 result ["count" ] = len (outdated_snapshots )
53- result ["outdated_snapshots " ] = outdated_snapshots
52+ result ["outdated_tests " ] = outdated_snapshots
5453 return result
5554
5655
@@ -93,10 +92,10 @@ def get_snapshots(path: str, date_limit: str, check_sub_dirs, combine_parametriz
9392 path , date_limit , check_sub_dirs , combine_parametrized , show_date
9493 )
9594 # sorted lists are prettier to read in the console
96- snapshots ["outdated_snapshots " ] = dict (sorted (snapshots ["outdated_snapshots " ].items ()))
95+ snapshots ["outdated_tests " ] = dict (sorted (snapshots ["outdated_tests " ].items ()))
9796
9897 # turn the list of snapshots into a whitespace separated string usable by pytest
99- join = " " .join (snapshots ["outdated_snapshots " ])
98+ join = " " .join (snapshots ["outdated_tests " ])
10099 snapshots ["pytest_executable_list" ] = join
101100 print (json .dumps (snapshots , default = str ))
102101
0 commit comments