`parametrize` should work with generators (#5354).
(pytester: Pytester)
| 447 | |
| 448 | |
| 449 | def test_parametrize_iterator(pytester: Pytester) -> None: |
| 450 | """`parametrize` should work with generators (#5354).""" |
| 451 | py_file = pytester.makepyfile( |
| 452 | """\ |
| 453 | import pytest |
| 454 | |
| 455 | def gen(): |
| 456 | yield 1 |
| 457 | yield 2 |
| 458 | yield 3 |
| 459 | |
| 460 | @pytest.mark.parametrize('a', gen()) |
| 461 | def test(a): |
| 462 | assert a >= 1 |
| 463 | """ |
| 464 | ) |
| 465 | result = pytester.runpytest(py_file) |
| 466 | assert result.ret == 0 |
| 467 | # should not skip any tests |
| 468 | result.stdout.fnmatch_lines(["*3 passed*"]) |
| 469 | |
| 470 | |
| 471 | class TestFunctional: |
nothing calls this directly
no test coverage detected