From 608e9361e39fe905f6cb2dc13bfd9a50c1c02310 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sat, 25 Jul 2020 16:30:39 +0300 Subject: [PATCH] tools: run test-tool-option-parsing.py like a regular test Signed-off-by: Ran Benita --- meson.build | 13 +++---------- .../tool-option-parsing.py | 6 ++++-- 2 files changed, 7 insertions(+), 12 deletions(-) rename tools/test-tool-option-parsing.py => test/tool-option-parsing.py (98%) diff --git a/meson.build b/meson.build index e201d7c..a4b0f7b 100644 --- a/meson.build +++ b/meson.build @@ -639,17 +639,10 @@ You can disable the Wayland xkbcli programs with -Denable-wayland=false.''') install_man('tools/xkbcli-list.1') endif - # pytest finds files named test_foo_bar.py but not - # test-foo-bar.py, let's rename the source file so it only ever finds the - # built one. - config_tool_option_test = configuration_data() - config_tool_option_test.set('MESON_BUILD_ROOT', meson.current_build_dir()) - tool_option_test = configure_file(input: 'tools/test-tool-option-parsing.py', - output: 'test_tool_option_parsing.py', - configuration : config_tool_option_test) test('tool-option-parsing', - tool_option_test, - args: [tool_option_test, '-n', 'auto']) + find_program('test/tool-option-parsing.py'), + env: test_env, + suite: ['python-tests']) endif diff --git a/tools/test-tool-option-parsing.py b/test/tool-option-parsing.py similarity index 98% rename from tools/test-tool-option-parsing.py rename to test/tool-option-parsing.py index 27af46e..764e3f2 100755 --- a/tools/test-tool-option-parsing.py +++ b/test/tool-option-parsing.py @@ -35,6 +35,8 @@ except ImportError: sys.exit(77) +top_builddir = os.environ['top_builddir'] + logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger('test') logger.setLevel(logging.DEBUG) @@ -67,7 +69,7 @@ class XkbcliTool: subtool = None def __init__(self, subtool=None): - self.tool_path = "@MESON_BUILD_ROOT@" + self.tool_path = top_builddir self.subtool = subtool def run_command(self, args): @@ -297,4 +299,4 @@ def test_interactive_wayland(xkbcli_interactive_wayland): if __name__ == '__main__': - pytest.main(args=['@MESON_BUILD_ROOT@']) + sys.exit(pytest.main(args=[__file__])) -- 2.7.4