summaryrefslogtreecommitdiff
path: root/plac/doc/test_plac.py
diff options
context:
space:
mode:
Diffstat (limited to 'plac/doc/test_plac.py')
-rw-r--r--plac/doc/test_plac.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/plac/doc/test_plac.py b/plac/doc/test_plac.py
index 20d7690..df6c060 100644
--- a/plac/doc/test_plac.py
+++ b/plac/doc/test_plac.py
@@ -114,6 +114,8 @@ def assert_usage(parser, expected):
assert usage == expected, usage
def test_metavar_no_defaults():
+ sys.argv[0] = 'test_plac.py'
+
# positional
p = parser_from(lambda x: None,
x=('first argument', 'positional', None, str, [], 'METAVAR'))
@@ -123,8 +125,11 @@ def test_metavar_no_defaults():
p = parser_from(lambda x: None,
x=('first argument', 'option', None, str, [], 'METAVAR'))
assert_usage(p, 'usage: test_plac.py [-h] [-x METAVAR]\n')
+ sys.argv[0] = sys_argv0
def test_metavar_with_defaults():
+ sys.argv[0] = 'test_plac.py'
+
# positional
p = parser_from(lambda x='a': None,
x=('first argument', 'positional', None, str, [], 'METAVAR'))
@@ -139,6 +144,8 @@ def test_metavar_with_defaults():
x=('first argument', 'option', None, str, []))
assert_usage(p, 'usage: test_plac.py [-h] [-x a]\n')
+ sys.argv[0] = sys_argv0
+
def test_kwargs():
def main(opt, arg1, *args, **kw):
print(opt, arg1)