Skip to content

Commit d64621e

Browse files
committed
fix(consume): use parameter-based test discovery in pytest_generate_tests
Replace hardcoded function name check with parameter-based discovery for better maintainability. This avoids the design flaw of production code referencing specific test function names. Fixes unit test failures by checking for 'test_case' parameter presence instead of maintaining an allowlist of function names.
1 parent 4447e65 commit d64621e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pytest_plugins/consume/consume.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,8 @@ def pytest_generate_tests(metafunc):
558558
if "cache" in sys.argv:
559559
return
560560

561-
# Only apply to simulator test functions to avoid conflicts with other consume simulators
562-
if metafunc.function.__name__ not in ["test_blockchain_via_engine", "test_via_rlp"]:
561+
# Only apply to functions that have a 'test_case' parameter (consume test functions)
562+
if "test_case" not in metafunc.fixturenames:
563563
return
564564

565565
test_cases = metafunc.config.test_cases

0 commit comments

Comments
 (0)