1414import signal
1515import os
1616import tempfile
17- import random
1817import shutil
1918
2019import botocore .session
2120from awscli .testutils import unittest , aws , BaseS3CLICommand
2221from awscli .testutils import temporary_file
2322from awscli .testutils import skip_if_windows
23+ from awscli .testutils import random_bucket_name
2424from awscli .clidriver import create_clidriver
2525
2626
@@ -159,8 +159,7 @@ def test_param_with_file(self):
159159 def test_streaming_output_operation (self ):
160160 d = tempfile .mkdtemp ()
161161 self .addCleanup (shutil .rmtree , d )
162- bucket_name = 'clistream' + str (
163- int (time .time ())) + str (random .randint (1 , 100 ))
162+ bucket_name = random_bucket_name ('clistream' )
164163
165164 self .put_object (bucket = bucket_name , key = 'foobar' ,
166165 content = 'foobar contents' )
@@ -179,8 +178,7 @@ def test_no_sign_request(self):
179178 env_vars ['AWS_ACCESS_KEY_ID' ] = 'foo'
180179 env_vars ['AWS_SECRET_ACCESS_KEY' ] = 'bar'
181180
182- bucket_name = 'nosign' + str (
183- int (time .time ())) + str (random .randint (1 , 100 ))
181+ bucket_name = random_bucket_name ('nosign' )
184182 self .put_object (bucket_name , 'foo' , content = 'bar' ,
185183 extra_args = {'ACL' : 'public-read-write' })
186184
@@ -203,8 +201,7 @@ def test_no_sign_request(self):
203201 def test_no_paginate_arg (self ):
204202 d = tempfile .mkdtemp ()
205203 self .addCleanup (shutil .rmtree , d )
206- bucket_name = 'nopaginate' + str (
207- int (time .time ())) + str (random .randint (1 , 100 ))
204+ bucket_name = random_bucket_name ('nopaginate' )
208205
209206 self .put_object (bucket = bucket_name , key = 'foobar' ,
210207 content = 'foobar contents' )
0 commit comments