summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGábor Bernát <gaborjbernat@gmail.com>2018-03-23 21:56:09 +0100
committerOliver Bestwalter <oliver.bestwalter@avira.com>2018-03-23 21:56:46 +0100
commit3ab629693ec89c1f7e38d445d7b91a2d241ed720 (patch)
tree4bf7f1522eeefb1c2c4b298bc4e13f2ea3db5047
parent6f0b7dcd6eb3e1d8c3ced01ee7439befd509639c (diff)
downloadtox-git-3ab629693ec89c1f7e38d445d7b91a2d241ed720.tar.gz
#773 allow cmdline to be called bot with and without args, make args use sys.args if not specified (#777)
(cherry picked from commit 83f9a62)
-rw-r--r--tests/test_z_cmdline.py7
-rw-r--r--tox/session.py6
2 files changed, 10 insertions, 3 deletions
diff --git a/tests/test_z_cmdline.py b/tests/test_z_cmdline.py
index 04aee08b..469b3066 100644
--- a/tests/test_z_cmdline.py
+++ b/tests/test_z_cmdline.py
@@ -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,
diff --git a/tox/session.py b/tox/session.py
index a73c8f5f..7f013e45 100644
--- a/tox/session.py
+++ b/tox/session.py
@@ -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):