Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tests/integration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
# distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
import time

import botocore
import botocore.session
from botocore.exceptions import WaiterError
Expand Down Expand Up @@ -61,6 +63,7 @@ def setUpClass(cls):
cls.client.create_bucket(
Bucket=cls.bucket_name,
CreateBucketConfiguration={'LocationConstraint': cls.region})
cls.wait_bucket_exists(cls.bucket_name)

def setUp(self):
self.files = FileCreator()
Expand All @@ -72,6 +75,12 @@ def tearDown(self):
def tearDownClass(cls):
recursive_delete(cls.client, cls.bucket_name)

@classmethod
def wait_bucket_exists(cls, bucket_name, num_success=5, initial_delay=2):
time.sleep(initial_delay)
for _ in range(num_success):
cls.client.get_waiter('bucket_exists').wait(Bucket=bucket_name)

def delete_object(self, key):
self.client.delete_object(
Bucket=self.bucket_name,
Expand Down