From c0a23aca06c97726d3246bbff0d39084c64fb21d Mon Sep 17 00:00:00 2001 From: Warren Date: Mon, 18 Mar 2024 07:51:00 +1100 Subject: [PATCH] refactor(test): make expected output explicit instead of calculated --- testing/python/show_fixtures_per_test.py | 38 ++++++++++++------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/testing/python/show_fixtures_per_test.py b/testing/python/show_fixtures_per_test.py index 87e7a76f3..38902f7eb 100644 --- a/testing/python/show_fixtures_per_test.py +++ b/testing/python/show_fixtures_per_test.py @@ -303,23 +303,23 @@ def test_should_show_parametrized_fixtures_used_by_test(pytester: Pytester) -> N result = pytester.runpytest("--fixtures-per-test", p) assert result.ret == 0 - expected_matches_for_directly_parametrized_fixture_test = [ - "*fixtures used by test_directly_parametrized_fixture*", - "*(test_should_show_parametrized_fixtures_used_by_test.py:14)*", - "directly -- test_should_show_parametrized_fixtures_used_by_test.py:4", - " parametrized fixture", - ] - - expected_matches_for_indirectly_parametrized_fixture_test = [ - "*fixtures used by test_indirectly_parametrized_fixture*", - "*(test_should_show_parametrized_fixtures_used_by_test.py:17)*", - "indirectly -- test_should_show_parametrized_fixtures_used_by_test.py:9", - " indirectly parametrized fixture", - ] - - expected_matches = ( - expected_matches_for_directly_parametrized_fixture_test * 2 - + expected_matches_for_indirectly_parametrized_fixture_test * 2 + result.stdout.fnmatch_lines( + [ + "*fixtures used by test_directly_parametrized_fixture*", + "*(test_should_show_parametrized_fixtures_used_by_test.py:14)*", + "directly -- test_should_show_parametrized_fixtures_used_by_test.py:4", + " parametrized fixture", + "*fixtures used by test_directly_parametrized_fixture*", + "*(test_should_show_parametrized_fixtures_used_by_test.py:14)*", + "directly -- test_should_show_parametrized_fixtures_used_by_test.py:4", + " parametrized fixture", + "*fixtures used by test_indirectly_parametrized_fixture*", + "*(test_should_show_parametrized_fixtures_used_by_test.py:17)*", + "indirectly -- test_should_show_parametrized_fixtures_used_by_test.py:9", + " indirectly parametrized fixture", + "*fixtures used by test_indirectly_parametrized_fixture*", + "*(test_should_show_parametrized_fixtures_used_by_test.py:17)*", + "indirectly -- test_should_show_parametrized_fixtures_used_by_test.py:9", + " indirectly parametrized fixture", + ] ) - - result.stdout.fnmatch_lines(expected_matches)