Skip to content

Commit 83f9a62

Browse files
gaborbernatobestwalter
authored andcommitted
#773 allow cmdline to be called bot with and without args, make args use sys.args if not specified (#777)
1 parent 284ed9d commit 83f9a62

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

tests/test_z_cmdline.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,12 +902,17 @@ def test_tox_quickstart_script():
902902
assert result == 0
903903

904904

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

910910

911+
def test_tox_cmdline_args(monkeypatch):
912+
with pytest.raises(SystemExit):
913+
tox.cmdline(['caller_script', '--help'])
914+
915+
911916
@pytest.mark.parametrize('exit_code', [0, 6])
912917
def test_exit_code(initproj, cmd, exit_code, mocker):
913918
""" Check for correct InvocationError, with exit code,

tox/session.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ def prepare(args):
3434
return config
3535

3636

37-
def run_main():
38-
main(sys.argv[1:])
37+
def run_main(args=None):
38+
if args is None:
39+
args = sys.argv[1:]
40+
main(args)
3941

4042

4143
def main(args):

0 commit comments

Comments
 (0)