Skip to content

#773 allow cmdline to be called bot with and without args, make args use sys.args if not specified #777

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

Merged
merged 1 commit into from
Mar 23, 2018
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
7 changes: 6 additions & 1 deletion tests/test_z_cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,12 +902,17 @@ def test_tox_quickstart_script():
assert result == 0


def test_tox_cmdline(monkeypatch):
def test_tox_cmdline_no_args(monkeypatch):
monkeypatch.setattr(sys, 'argv', ['caller_script', '--help'])
with pytest.raises(SystemExit):
tox.cmdline()


def test_tox_cmdline_args(monkeypatch):
with pytest.raises(SystemExit):
tox.cmdline(['caller_script', '--help'])


@pytest.mark.parametrize('exit_code', [0, 6])
def test_exit_code(initproj, cmd, exit_code, mocker):
""" Check for correct InvocationError, with exit code,
Expand Down
6 changes: 4 additions & 2 deletions tox/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ def prepare(args):
return config


def run_main():
main(sys.argv[1:])
def run_main(args=None):
if args is None:
args = sys.argv[1:]
main(args)


def main(args):
Expand Down