diff --git a/src/_pytest/python.py b/src/_pytest/python.py index 4f7313e6b..9238694c3 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -1419,7 +1419,7 @@ class Metafunc: actual_param_count = len(argnames) fail( - f"In function {self.function.__name__}: {argnames} is not a valid parameter. " + f"In function {self.function.__name__}: {argnames} is not a valid parameter. \n" f"Expected {expected_param_count} sub parameters, " f"but only {actual_param_count} were provided. \n\n" f"Make sure to pass parameter names as strings without quotes, separated by commas, \n " diff --git a/testing/test_mark.py b/testing/test_mark.py index 46bbf58a7..f9eee67cc 100644 --- a/testing/test_mark.py +++ b/testing/test_mark.py @@ -421,8 +421,8 @@ def test_parametrized_collect_with_wrong_format(pytester: Pytester) -> None: result = pytester.runpytest(py_file) result.stdout.fnmatch_lines( [ - """In function test_parametrization: ['arg1'] is not a valid parameter. - Expected 2 sub parameters, but only 1 were provided. """, + "In function test_parametrization: ['arg1'] is not a valid parameter. ", + "Expected 2 sub parameters, but only 1 were provided. ", "", "Make sure to pass parameter names as strings without quotes, separated by commas, ", " e.g., '@pytest.mark.parametrize(\"arg1\", )'",