Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show invalid ini keys sorted #7303

Merged
merged 1 commit into from
Jun 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/_pytest/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ def _checkversion(self):
)

def _validatekeys(self):
for key in self._get_unknown_ini_keys():
for key in sorted(self._get_unknown_ini_keys()):
message = "Unknown config ini key: {}\n".format(key)
if self.known_args_namespace.strict_config:
fail(message, pytrace=False)
Expand Down
8 changes: 3 additions & 5 deletions testing/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ def test_confcutdir(self, testdir):
""",
["unknown_ini", "another_unknown_ini"],
[
"WARNING: Unknown config ini key: unknown_ini",
"WARNING: Unknown config ini key: another_unknown_ini",
"WARNING: Unknown config ini key: unknown_ini",
],
"Unknown config ini key: unknown_ini",
"Unknown config ini key: another_unknown_ini",
),
(
"""
Expand Down Expand Up @@ -200,9 +200,7 @@ def test_invalid_ini_keys(
):
testdir.tmpdir.join("pytest.ini").write(textwrap.dedent(ini_file_text))
config = testdir.parseconfig()
assert config._get_unknown_ini_keys() == invalid_keys, str(
config._get_unknown_ini_keys()
)
assert sorted(config._get_unknown_ini_keys()) == sorted(invalid_keys)

result = testdir.runpytest()
result.stderr.fnmatch_lines(stderr_output)
Expand Down