mirror of
https://github.com/xtream1101/humblebundle-downloader.git
synced 2025-02-02 03:52:41 +01:00
Merge pull request #48 from shane-kerr/fix-cli-no-args
Fix crash if no arguments are passed to CLI
This commit is contained in:
commit
c09da8039a
@ -15,7 +15,7 @@ logging.getLogger('urllib3.connectionpool').setLevel(logging.WARNING)
|
|||||||
|
|
||||||
|
|
||||||
def parse_args(args):
|
def parse_args(args):
|
||||||
if args[0].lower() == 'download':
|
if len(args) > 0 and args[0].lower() == 'download':
|
||||||
args = args[1:]
|
args = args[1:]
|
||||||
raise DeprecationWarning("`download` argument is no longer used")
|
raise DeprecationWarning("`download` argument is no longer used")
|
||||||
|
|
||||||
|
@ -11,3 +11,9 @@ def test_no_action():
|
|||||||
args = parse_args(['-l', 'some_path', '-c', 'fake_cookie'])
|
args = parse_args(['-l', 'some_path', '-c', 'fake_cookie'])
|
||||||
assert args.library_path == 'some_path'
|
assert args.library_path == 'some_path'
|
||||||
assert args.cookie_file == 'fake_cookie'
|
assert args.cookie_file == 'fake_cookie'
|
||||||
|
|
||||||
|
|
||||||
|
def test_no_args():
|
||||||
|
with pytest.raises(SystemExit) as ex:
|
||||||
|
parse_args([])
|
||||||
|
assert ex.value.code == 2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user