99import os
1010import requests
1111from pathlib import Path
12- from datetime import datetime
12+ from datetime import datetime , timezone
1313from astropy .coordinates import SkyCoord
1414from astropy .io import fits
1515from astropy import units as u
@@ -99,7 +99,7 @@ def test_query(self):
9999 assert 1000 < result [0 ][0 ]
100100
101101 # test that no proprietary results are returned when not logged in
102- now = datetime .utcnow ( )
102+ now = datetime .now ( timezone . utc )
103103 query = "select top 1 * from caom2.Plane where " \
104104 "metaRelease>'{}'" .format (now .strftime ('%Y-%m-%dT%H:%M:%S.%f' ))
105105 result = cadc .exec_sync (query )
@@ -121,7 +121,7 @@ def test_login_with_user_password(self):
121121 for auth_session in [None , authsession .AuthSession (),
122122 requests .Session ()]:
123123 cadc = Cadc (auth_session = auth_session )
124- now = datetime .utcnow ( )
124+ now = datetime .now ( timezone . utc )
125125 query = \
126126 "select top 1 * from caom2.Plane where metaRelease>'{}'" .\
127127 format (now .strftime ('%Y-%m-%dT%H:%M:%S.%f' ))
@@ -152,7 +152,7 @@ def test_login_with_user_password(self):
152152 def test_login_with_cert (self ):
153153 for auth_session in [requests .Session ()]:
154154 cadc = Cadc (auth_session = auth_session )
155- now = datetime .utcnow ( )
155+ now = datetime .now ( timezone . utc )
156156 query = \
157157 "select top 1 * from caom2.Plane where metaRelease>'{}'" .\
158158 format (now .strftime ('%Y-%m-%dT%H:%M:%S.%f' ))
@@ -181,14 +181,14 @@ def test_authsession(self):
181181 auth_session = requests .Session ()
182182 auth_session .cert = os .environ ['CADC_CERT' ]
183183 cadc = Cadc (auth_session = auth_session )
184- now = datetime .utcnow ( )
184+ now = datetime .now ( timezone . utc )
185185 query = "select top 1 * from caom2.Plane where " \
186186 "metaRelease>'{}'" .format (now .strftime ('%Y-%m-%dT%H:%M:%S.%f' ))
187187 result = cadc .exec_sync (query )
188188 assert len (result ) == 1
189189 annon_session = requests .Session ()
190190 cadc = Cadc (auth_session = annon_session )
191- now = datetime .utcnow ( )
191+ now = datetime .now ( timezone . utc )
192192 query = "select top 1 * from caom2.Plane where " \
193193 "metaRelease>'{}'" .format (now .strftime ('%Y-%m-%dT%H:%M:%S.%f' ))
194194 result = cadc .exec_sync (query )
0 commit comments