diff --git a/s3tests/common/__init__.py b/s3tests/common/__init__.py index 373d191..7039d43 100644 --- a/s3tests/common/__init__.py +++ b/s3tests/common/__init__.py @@ -10,7 +10,13 @@ s3 = bunch.Bunch() config = bunch.Bunch() prefix = '' +# For those scripts that use a context, these are pretty univerally needed. +context = bunch.Bunch( + bucket = None, +) + bucket_counter = itertools.count(1) +key_counter = itertools.count(1) def choose_bucket_prefix(template, max_len=30): """ @@ -156,3 +162,12 @@ def get_new_bucket(connection=None): def teardown(): nuke_prefixed_buckets() + +def fill_pools(*args): + for pool in args: + while not pool.full(): + pool.spawn() + +def get_next_key(bucket=None): + return bucket.new_key("seqkey-{num}".format(num=next(key_counter))) +