From bf4ce2b832c9323f92e16b1913ea4da7859fcd27 Mon Sep 17 00:00:00 2001 From: Adam Yoblick Date: Wed, 24 Jul 2024 00:02:17 -0500 Subject: [PATCH] Fix bug in parser and fix unit test --- src/debugpy/server/cli.py | 10 +++++----- tests/debugpy/server/test_cli.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/debugpy/server/cli.py b/src/debugpy/server/cli.py index 038f2b55..90cd3885 100644 --- a/src/debugpy/server/cli.py +++ b/src/debugpy/server/cli.py @@ -202,11 +202,11 @@ def consume_argv(): def consume_args(args: list): if (args is sys.argv): yield from consume_argv() - - while len(args) >= 1: - value = args[0] - del args[0] - yield value + else: + while len(args) >= 1: + value = args[0] + del args[0] + yield value # Parse the args from the command line, then from the environment. # Args from the environment are only used if they are not already set from the command line. diff --git a/tests/debugpy/server/test_cli.py b/tests/debugpy/server/test_cli.py index 28bda085..141d3266 100644 --- a/tests/debugpy/server/test_cli.py +++ b/tests/debugpy/server/test_cli.py @@ -180,7 +180,7 @@ def test_address_required(cli): def test_missing_target(cli): with pytest.raises(ValueError) as ex: - cli(["--listen", "8888", "-m", ""]) + cli(["--listen", "8888"]) assert "missing target" in str(ex.value)