mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-02 07:30:11 +01:00
tools: fix the tool option parse test to handle unittest arguments
Pass arguments we don't handle directly through to the unittest module. This way we can filter tests with -k testname etc. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
5d7c93a3d1
commit
79293ea456
2 changed files with 7 additions and 6 deletions
|
|
@ -605,7 +605,7 @@ executable('ptraccel-debug',
|
|||
if get_option('buildtype') == 'debug' or get_option('buildtype') == 'debugoptimized'
|
||||
test('tool-option-parsing',
|
||||
find_program('tools/test-tool-option-parsing.py'),
|
||||
args : [libinput_tool.full_path()],
|
||||
args : ['--tool-path', libinput_tool.full_path()],
|
||||
timeout : 120)
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -210,15 +210,16 @@ if __name__ == '__main__':
|
|||
sys.exit(77)
|
||||
|
||||
parser = argparse.ArgumentParser(description='Verify a libinput tool\'s option parsing')
|
||||
parser.add_argument('tool_path', metavar='/path/to/builddir/libinput',
|
||||
type=str, nargs='?',
|
||||
parser.add_argument('--tool-path', metavar='/path/to/builddir/libinput',
|
||||
type=str,
|
||||
help='Path to the libinput tool in the builddir')
|
||||
parser.add_argument('--verbose', action='store_true')
|
||||
args = parser.parse_args()
|
||||
args, remainder = parser.parse_known_args()
|
||||
if args.tool_path is not None:
|
||||
TestLibinputTool.libinput_tool = args.tool_path
|
||||
verbosity = 1
|
||||
if args.verbose:
|
||||
verbosity = 3
|
||||
del sys.argv[1:]
|
||||
unittest.main(verbosity=verbosity)
|
||||
|
||||
argv = [sys.argv[0], *remainder]
|
||||
unittest.main(verbosity=verbosity, argv=argv)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue