Am 22.04.2020 um 14:49 hat Vladimir Sementsov-Ogievskiy geschrieben: > 22.04.2020 14:53, Kevin Wolf wrote: > > Am 22.04.2020 um 07:35 hat Vladimir Sementsov-Ogievskiy geschrieben: > > > 21.04.2020 19:56, Kevin Wolf wrote: > > > > Am 21.04.2020 um 09:35 hat Vladimir Sementsov-Ogievskiy geschrieben: > > > > > +if __name__ == '__main__': > > > > > + if len(sys.argv) == 2 and sys.argv[1] in ['-h', '--help']: > > > > > + TestFinder.argparser.print_help() > > > > > + exit() > > > > > + > > > > > + tests, remaining_argv = find_tests(sys.argv[1:]) > > > > > + print('\n'.join(tests)) > > > > > + if remaining_argv: > > > > > + print('\nUnhandled options: ', remaining_argv) > > > > > > > > I think unhandled options shouldn't be considered an error and we > > > > shouldn't even try to find and display any tests then. I'd either print > > > > the help text or have an error message that refers to --help. > > > > > > As I considered running this script as executable for testing purposes, > > > it's > > > good to know, which options are not handled.. > > > > Yes, that makes sense. I just think it should be an error and not just > > an additional hint at the end. > > > > It's not and error, as usual case will leave some arguments for > TestEnv and TestRunner. Assume you run ./check with some arguments.. > > And it works bad. You assume that problem is in testfinder.py. Then, > you just take the entire list of options and call ./testfinder.py with > them. And it shows, how it parses its arguments, and what is reminded. > Seems correct and shouldn't be an error.
Hm, I didn't consider this use case. Fair enough then. > Still, maybe better to print unhandled options first, to be more > noticeable. Actually, I think it's more noticeable at the end when you execute the script standalone, especially when it prints a long list. Kevin