save work

This commit is contained in:
Adam Yoblick 2024-07-22 17:54:01 -05:00
parent e0f2a8be98
commit 382bc69a2b
2 changed files with 23 additions and 9 deletions

View file

@ -158,8 +158,12 @@ def set_target(kind: str, parser=(lambda x: x), positional=False):
import locale
target = target.decode(locale.getpreferredencoding(False))
options.target = target
log.debug("kind: " + kind)
log.debug("target: " + target)
return do
@ -199,7 +203,7 @@ def consume_argv():
# Consume all the args from a given list
def consume_args(args: list):
if (args == sys.argv):
if (args is sys.argv):
return consume_argv()
while len(args) >= 1:
@ -217,8 +221,8 @@ def parse_args():
parse_args_from_command_line(seen)
#parse_args_from_environment(seen)
#print("options:", file=sys.stderr)
#print(options.__dict__, file=sys.stderr)
log.debug("options:")
log.debug(options.__dict__)
if options.target is None:
raise ValueError("missing target: " + TARGET)
@ -253,7 +257,12 @@ def parse_args_from_environment(seenFromCommandLine: set):
def parse_args_helper(args: list, seenFromCommandLine: set, seenFromEnvironment: set = None, isFromEnvironment=False):
iterator = consume_args(args)
for arg in iterator:
while True:
try:
arg = next(iterator)
except StopIteration:
break
switch = arg
if not switch.startswith("-"):
switch = ""

View file

@ -73,11 +73,16 @@ def cli(pyfile):
# Test a combination of command line switches
@pytest.mark.parametrize("target_kind", ["file", "module", "code"])
@pytest.mark.parametrize("mode", ["listen", "connect"])
@pytest.mark.parametrize("address", ["8888", "localhost:8888"])
@pytest.mark.parametrize("wait_for_client", ["", "wait_for_client"])
@pytest.mark.parametrize("script_args", ["", "script_args"])
#@pytest.mark.parametrize("target_kind", ["file", "module", "code"])
#@pytest.mark.parametrize("mode", ["listen", "connect"])
#@pytest.mark.parametrize("address", ["8888", "localhost:8888"])
#@pytest.mark.parametrize("wait_for_client", ["", "wait_for_client"])
#@pytest.mark.parametrize("script_args", ["", "script_args"])
@pytest.mark.parametrize("target_kind", ["file"])
@pytest.mark.parametrize("mode", ["listen"])
@pytest.mark.parametrize("address", ["8888"])
@pytest.mark.parametrize("wait_for_client", ["wait_for_client"])
@pytest.mark.parametrize("script_args", ["script_args"])
def test_targets(cli, target_kind, mode, address, wait_for_client, script_args):
expected_options = {
"mode": mode,