]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
fixtures: split setup() and configure()
authorCasey Bodley <cbodley@redhat.com>
Fri, 12 Jan 2024 03:38:17 +0000 (22:38 -0500)
committerCasey Bodley <cbodley@redhat.com>
Sun, 10 Mar 2024 14:45:22 +0000 (10:45 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
s3tests_boto3/functional/__init__.py

index a65b54c6aeaeac500ca157dcf886fa7c65faf7ea..0636932a27cbd8d2c9558eebbc63e20829dc3e42 100644 (file)
@@ -174,7 +174,7 @@ def configured_storage_classes():
 
     return sc
 
-def setup():
+def configure():
     cfg = configparser.RawConfigParser()
     try:
         path = os.environ['S3TEST_CONF']
@@ -267,17 +267,17 @@ def setup():
         template = 'test-{random}-'
     prefix = choose_bucket_prefix(template=template)
 
-    alt_client = get_alt_client()
-    tenant_client = get_tenant_client()
-    nuke_prefixed_buckets(prefix=prefix)
-    nuke_prefixed_buckets(prefix=prefix, client=alt_client)
-    nuke_prefixed_buckets(prefix=prefix, client=tenant_client)
-
     if cfg.has_section("s3 cloud"):
         get_cloud_config(cfg)
     else:
         config.cloud_storage_class = None
 
+def setup():
+    alt_client = get_alt_client()
+    tenant_client = get_tenant_client()
+    nuke_prefixed_buckets(prefix=prefix)
+    nuke_prefixed_buckets(prefix=prefix, client=alt_client)
+    nuke_prefixed_buckets(prefix=prefix, client=tenant_client)
 
 def teardown():
     alt_client = get_alt_client()
@@ -306,11 +306,12 @@ def teardown():
 
 @pytest.fixture(scope="package")
 def configfile():
-    setup()
+    configure()
     return config
 
 @pytest.fixture(autouse=True)
 def setup_teardown(configfile):
+    setup()
     yield
     teardown()