From d587a4a49983651258f91a8a47b7faf0e7138ec3 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Wed, 4 Jun 2025 12:31:44 -0400 Subject: [PATCH] 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 --- s3tests/functional/test_s3_website.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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) -- 2.39.5