From: Casey Bodley Date: Wed, 4 Jun 2025 16:31:44 +0000 (-0400) Subject: website: use pytest parametrize for test_routing_generator() X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=7a87047015bec702b5964323b2beaecbed0e6d6b;p=s3-tests.git website: use pytest parametrize for test_routing_generator() resolves error with recent pytest: ==================================== ERRORS ==================================== ____________ ERROR collecting s3tests/functional/test_s3_website.py ____________ 'yield' keyword is allowed in fixtures, but not in tests (test_routing_generator) use https://docs.pytest.org/en/7.1.x/example/parametrize.html instead to generate a test_routing_generator() for each entry in ROUTING_RULES_TESTS Signed-off-by: Casey Bodley (cherry picked from commit d587a4a49983651258f91a8a47b7faf0e7138ec3) --- diff --git a/s3tests/functional/test_s3_website.py b/s3tests/functional/test_s3_website.py index 641cd716..7831796e 100644 --- a/s3tests/functional/test_s3_website.py +++ b/s3tests/functional/test_s3_website.py @@ -1077,8 +1077,8 @@ def routing_check(*args, **kwargs): @pytest.mark.s3website_routing_rules @pytest.mark.s3website @pytest.mark.fails_on_dbstore -def test_routing_generator(): - for t in ROUTING_RULES_TESTS: - if 'xml' in t and 'RoutingRules' in t['xml'] and len(t['xml']['RoutingRules']) > 0: - t['xml']['RoutingRules'] = common.trim_xml(t['xml']['RoutingRules']) - yield routing_check, t +@pytest.mark.parametrize('t', ROUTING_RULES_TESTS) +def test_routing_generator(t): + 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)