@@ -3305,23 +3305,20 @@ def test_access_time__issue_700(self):
33053305 if self .sess .server_version < (5 ,):
33063306 self .skipTest ("iRODS servers < 5.0.0 do not provide an access_time attribute for data objects." )
33073307
3308- data = None
33093308 prior_ts = datetime .now (timezone .utc ) - timedelta (seconds = 2 )
33103309
33113310 # Create a new, uniquely named test data object.
3312- logical_path = f'{ helpers .home_collection (self .sess )} /{ unique_name (my_function_name (), datetime .now ())} '
3311+ data = self .sess .data_objects .create (
3312+ logical_path := f'{ helpers .home_collection (self .sess )} /{ unique_name (my_function_name (), datetime .now ())} '
3313+ )
33133314
3314- try :
3315- with self .sess .data_objects .open (logical_path ,'w' ) as f :
3316- data = self .sess .data_objects .get (logical_path )
3317- self .assertEqual (data .access_time , data .modify_time )
3318- self .assertGreaterEqual (data .access_time , prior_ts )
3315+ with data .open ('w' ) as f :
3316+ data = self .sess .data_objects .get (logical_path )
3317+ self .assertEqual (data .access_time , data .modify_time )
3318+ self .assertGreaterEqual (data .access_time , prior_ts )
33193319
3320- # Test that access_time is there, and of the right type.
3321- self .assertIs (type (data .access_time ), datetime )
3322- finally :
3323- if data :
3324- self .sess .data_objects .unlink (data .path , force = True )
3320+ # Test that access_time is there, and of the right type.
3321+ self .assertIs (type (data .access_time ), datetime )
33253322
33263323if __name__ == "__main__" :
33273324 # let the tests find the parent irods lib
0 commit comments