MCPcopy
hub / github.com/tanelpoder/0xtools / generate_test_functions

Function generate_test_functions

xtop/tests/test_tui_mapping.py:273–285  ·  view source on GitHub ↗

Generate test functions dynamically for each test case

()

Source from the content-addressed store, hash-verified

271
272# Generate individual test functions for pytest
273def generate_test_functions():
274 """Generate test functions dynamically for each test case"""
275 for i, test_case in enumerate(TEST_CASES):
276 # Create a test function for this case
277 async def test_func():
278 await test_cli_mapping(test_case)
279
280 # Set function name and docstring
281 test_func.__name__ = f"test_cli_case_{i+1}_{test_case.name.replace(' ', '_').lower()}"
282 test_func.__doc__ = f"Test {i+1}: {test_case.name}"
283
284 # Add to module globals so pytest can find it
285 globals()[test_func.__name__] = pytest.mark.asyncio(test_func)
286
287
288# Generate the test functions

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected