-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added documentation about
@pytest_parametrize_plus
and `fixture_ref…
…`. Added a corresponding test.
- Loading branch information
Sylvain MARIE
committed
Jun 13, 2019
1 parent
7a12e6a
commit 61ba6d0
Showing
2 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
pytest_cases/tests/fixtures/test_fixture_in_parametrize_basic.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import pytest | ||
from pytest_cases import pytest_parametrize_plus, pytest_fixture_plus, fixture_ref | ||
|
||
|
||
@pytest.fixture | ||
def world_str(): | ||
return 'world' | ||
|
||
|
||
@pytest_fixture_plus | ||
@pytest_parametrize_plus('who', [fixture_ref(world_str), 'you']) | ||
def greetings(who): | ||
return 'hello ' + who | ||
|
||
|
||
@pytest_parametrize_plus('main_msg', ['nothing', fixture_ref(world_str), fixture_ref(greetings)]) | ||
@pytest.mark.parametrize('ending', ['?', '!']) | ||
def test_prints(main_msg, ending): | ||
print(main_msg + ending) | ||
|
||
|
||
def test_synthesis(module_results_dct): | ||
assert list(module_results_dct) == ['test_prints[test_prints_param__main_msg__0-nothing-?]', | ||
'test_prints[test_prints_param__main_msg__0-nothing-!]', | ||
'test_prints[world_str-?]', | ||
'test_prints[world_str-!]', | ||
'test_prints[greetings-world_str-?]', | ||
'test_prints[greetings-world_str-!]', | ||
'test_prints[greetings-greetings_param__who__1-you-?]', | ||
'test_prints[greetings-greetings_param__who__1-you-!]'] |