From 9839a407c2353125bb867dec67a8f9960b1a2065 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Wed, 4 Jun 2025 18:31:39 -0400 Subject: [PATCH] website: routing_setup() as pytest fixture c80e9d2118ca5bcdec5285898a532f8e18faa6b6 had removed the use of routing_setup() without adding a fixture to replace it. this had broken routing_check(), but we hadn't noticed it because pytest hadn't supported the 'yield' pattern in test_routing_generator() to call it test_routing_generator() now uses this routing_setup fixture to provide the kwargs that had previously been injected into routing_check() via @common.with_setup_kwargs(setup=routing_setup, teardown=routing_teardown) Signed-off-by: Casey Bodley --- s3tests/functional/test_s3_website.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/s3tests/functional/test_s3_website.py b/s3tests/functional/test_s3_website.py index 7831796e..4df5f901 100644 --- a/s3tests/functional/test_s3_website.py +++ b/s3tests/functional/test_s3_website.py @@ -1002,8 +1002,8 @@ for redirect_code in VALID_AMZ_REDIRECT: # give an error of 'The provided HTTP redirect code (314) is not valid. Valid codes are 3XX except 300.' during setting the website config # we should check that we can return that too on ceph +@pytest.fixture def routing_setup(): - check_can_test_website() kwargs = {'obj':[]} bucket = get_new_bucket() kwargs['bucket'] = bucket @@ -1033,9 +1033,8 @@ def routing_setup(): while bucket.get_key(f['ErrorDocument_Key']) is None: time.sleep(SLEEP_INTERVAL) - return kwargs + yield kwargs -def routing_teardown(**kwargs): for o in reversed(kwargs['obj']): print('Deleting', str(o)) o.delete() @@ -1078,7 +1077,7 @@ def routing_check(*args, **kwargs): @pytest.mark.s3website @pytest.mark.fails_on_dbstore @pytest.mark.parametrize('t', ROUTING_RULES_TESTS) -def test_routing_generator(t): +def test_routing_generator(t, routing_setup): if 'xml' in t and 'RoutingRules' in t['xml'] and len(t['xml']['RoutingRules']) > 0: t['xml']['RoutingRules'] = common.trim_xml(t['xml']['RoutingRules']) - routing_check(t) + routing_check(t, **routing_setup) -- 2.39.5