eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit 96e8c0a3abb478452db8529995075ce520fbef21
parent 01efa0171d6f3f21a8e9e70eca1faf57c8b34ba6
Author: James Prestwood <prestwoj@gmail.com>
Date:   Tue,  5 Apr 2022 11:30:11 -0700

test-runner: fix --help and unknown options

If --help or unknown options were supplied to test-runner python
would thrown a maximum recusion depth exception. This was due to
the way ArgumentParser was subclassed.

To fix this call ArgumentParser.__init__() rather than using the
super() method. And do this also for the RunnerCoreArgParse
subclass as well. In addition the namespace argument was removed
from parse_args since its not used, and instead supplied directly
to the parents parse_args method.

Diffstat:
Mtools/runner.py | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/runner.py b/tools/runner.py @@ -82,7 +82,7 @@ class RunnerNamespace(Namespace): # class RunnerCoreArgParse(ArgumentParser): def __init__(self, *args, **kwargs): - super().__init__(self, *args, **kwargs) + ArgumentParser.__init__(self, *args, **kwargs) self.add_argument('--start', '-s', help='Custom init process in virtual environment', @@ -144,23 +144,23 @@ class RunnerCoreArgParse(ArgumentParser): dest='valgrind') # Overwrite to use a custom namespace class and parse from env - def parse_args(self, *args, namespace=RunnerNamespace()): + def parse_args(self, *args): if len(sys.argv) > 1: - return super().parse_args(*args, namespace=namespace) + return super().parse_args(*args, namespace=RunnerNamespace()) options = [] for k, v in os.environ.items(): options.append('--' + k) options.append(v) - return self.parse_known_args(args=options, namespace=namespace)[0] + return self.parse_known_args(args=options, namespace=RunnerNamespace())[0] # # Arguments only needed outside the test environment # class RunnerArgParse(RunnerCoreArgParse): def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) + RunnerCoreArgParse.__init__(self, *args, **kwargs) self.add_argument('--runner', '-r', metavar='<runner type>',