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

Fixed irrelevant Error message for invalid argument when running outside a directory with tox support files #1546 #1547

Merged
merged 3 commits into from
Mar 27, 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
1 change: 1 addition & 0 deletions docs/changelog/1547.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix irrelevant Error message for invalid argument when running outside a directory with tox support files by :user:`nkpro2000sr`.
5 changes: 5 additions & 0 deletions src/tox/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,11 @@ def parseconfig(args, plugins=()):
pm.hook.tox_configure(config=config) # post process config object
break
else:
parser = Parser()
pm.hook.tox_addoption(parser=parser)
# if no tox config file, now we need do a strict argument evaluation
# raise on unknown args
parser.parse_cli(args, strict=True)
if option.help or option.helpini:
return config
msg = "tox config file (either {}) not found"
Expand Down
19 changes: 19 additions & 0 deletions tests/unit/test_z_cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,25 @@ def test_notoxini_noerror_in_help_ini(initproj, cmd):
assert result.err != msg


def test_unrecognized_arguments_error(initproj, cmd):
initproj(
"examplepro1",
filedefs={
"tests": {"test_hello.py": "def test_hello(): pass"},
"tox.ini": """
[testenv:hello]
[testenv:world]
""",
},
)
result1 = cmd("--invalid-argument")
withtoxini = result1.err
initproj("examplepro2", filedefs={})
result2 = cmd("--invalid-argument")
notoxini = result2.err
assert withtoxini == notoxini


def test_envdir_equals_toxini_errors_out(cmd, initproj):
initproj(
"interp123-0.7",
Expand Down