@@ -285,7 +285,11 @@ def test_invalid_x_qiniu_date_with_disable_date_sign(self):
285
285
def test_invalid_x_qiniu_date_env (self ):
286
286
os .environ ['DISABLE_QINIU_TIMESTAMP_SIGNATURE' ] = 'True'
287
287
ret , info = self .bucket .stat (bucket_name , 'python-sdk.html' )
288
- os .unsetenv ('DISABLE_QINIU_TIMESTAMP_SIGNATURE' )
288
+ if hasattr (os , 'unsetenv' ):
289
+ os .unsetenv ('DISABLE_QINIU_TIMESTAMP_SIGNATURE' )
290
+ else :
291
+ # fix unsetenv not exists in earlier python on windows
292
+ os .environ ['DISABLE_QINIU_TIMESTAMP_SIGNATURE' ] = ''
289
293
assert 'hash' in ret
290
294
291
295
@freeze_time ("1970-01-01" )
@@ -294,7 +298,11 @@ def test_invalid_x_qiniu_date_env_be_ignored(self):
294
298
q = Auth (access_key , secret_key , disable_qiniu_timestamp_signature = False )
295
299
bucket = BucketManager (q )
296
300
ret , info = bucket .stat (bucket_name , 'python-sdk.html' )
297
- os .unsetenv ('DISABLE_QINIU_TIMESTAMP_SIGNATURE' )
301
+ if hasattr (os , 'unsetenv' ):
302
+ os .unsetenv ('DISABLE_QINIU_TIMESTAMP_SIGNATURE' )
303
+ else :
304
+ # fix unsetenv not exists in earlier python on windows
305
+ os .environ ['DISABLE_QINIU_TIMESTAMP_SIGNATURE' ] = ''
298
306
assert ret is None
299
307
assert info .status_code == 403
300
308
0 commit comments