refactor(test): rename test functions
This commit is contained in:
parent
b9e7493f8a
commit
a2450647c1
|
@ -256,11 +256,10 @@ def test_verbose_include_multiline_docstring(pytester: Pytester) -> None:
|
||||||
|
|
||||||
def test_should_not_show_pseudo_fixtures(pytester: Pytester) -> None:
|
def test_should_not_show_pseudo_fixtures(pytester: Pytester) -> None:
|
||||||
"""A fixture is considered pseudo if it was directly created using the
|
"""A fixture is considered pseudo if it was directly created using the
|
||||||
@pytest.mark.parametrize decorator as part of internal pytest mechanisms
|
``@pytest.mark.parametrize`` decorator as part of internal pytest
|
||||||
to manage batch execution. These fixtures should not be included in the
|
mechanisms (such as to manage batch execution). These fixtures should not
|
||||||
output because they don't satisfy user expectations for how fixtures are
|
be included in the output because they don't satisfy user expectations for
|
||||||
created and used."""
|
how fixtures are created and used."""
|
||||||
|
|
||||||
p = pytester.makepyfile(
|
p = pytester.makepyfile(
|
||||||
"""
|
"""
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -293,34 +292,34 @@ def test_should_show_parametrized_fixtures_used_by_test(pytester: Pytester) -> N
|
||||||
"""indirectly parametrized fixture"""
|
"""indirectly parametrized fixture"""
|
||||||
return request.param
|
return request.param
|
||||||
|
|
||||||
def test_parametrized_fixture(directly):
|
def test_directly_parametrized_fixture(directly):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@pytest.mark.parametrize("indirectly", ["a", "b"], indirect=True)
|
@pytest.mark.parametrize("indirectly", ["a", "b"], indirect=True)
|
||||||
def test_indirectly_parametrized(indirectly):
|
def test_indirectly_parametrized_fixture(indirectly):
|
||||||
pass
|
pass
|
||||||
'''
|
'''
|
||||||
)
|
)
|
||||||
result = pytester.runpytest("--fixtures-per-test", p)
|
result = pytester.runpytest("--fixtures-per-test", p)
|
||||||
assert result.ret == 0
|
assert result.ret == 0
|
||||||
|
|
||||||
expected_matches_for_parametrized_test = [
|
expected_matches_for_directly_parametrized_fixture_test = [
|
||||||
"*fixtures used by test_parametrized_fixture*",
|
"*fixtures used by test_directly_parametrized_fixture*",
|
||||||
"*(test_should_show_parametrized_fixtures_used_by_test.py:14)*",
|
"*(test_should_show_parametrized_fixtures_used_by_test.py:14)*",
|
||||||
"directly -- test_should_show_parametrized_fixtures_used_by_test.py:4",
|
"directly -- test_should_show_parametrized_fixtures_used_by_test.py:4",
|
||||||
" parametrized fixture",
|
" parametrized fixture",
|
||||||
]
|
]
|
||||||
|
|
||||||
expected_matches_for_indirectly_parametrized_test = [
|
expected_matches_for_indirectly_parametrized_fixture_test = [
|
||||||
"*fixtures used by test_indirectly_parametrized*",
|
"*fixtures used by test_indirectly_parametrized_fixture*",
|
||||||
"*(test_should_show_parametrized_fixtures_used_by_test.py:17)*",
|
"*(test_should_show_parametrized_fixtures_used_by_test.py:17)*",
|
||||||
"indirectly -- test_should_show_parametrized_fixtures_used_by_test.py:9",
|
"indirectly -- test_should_show_parametrized_fixtures_used_by_test.py:9",
|
||||||
" indirectly parametrized fixture",
|
" indirectly parametrized fixture",
|
||||||
]
|
]
|
||||||
|
|
||||||
expected_matches = (
|
expected_matches = (
|
||||||
expected_matches_for_parametrized_test * 2
|
expected_matches_for_directly_parametrized_fixture_test * 2
|
||||||
+ expected_matches_for_indirectly_parametrized_test * 2
|
+ expected_matches_for_indirectly_parametrized_fixture_test * 2
|
||||||
)
|
)
|
||||||
|
|
||||||
result.stdout.fnmatch_lines(expected_matches)
|
result.stdout.fnmatch_lines(expected_matches)
|
||||||
|
|
Loading…
Reference in New Issue