From 824cfbd81e2eb6594a6c83e4dd25f53aff36f759 Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Mon, 15 Jul 2019 17:50:11 -0400 Subject: [PATCH] `test_plugin.py`: use absolute paths for plugin path comparison Under a MinGW 64 test environment, the `BABELTRACE_PLUGIN_PATH` environment variable gets translated to NT path by MinGW since the passed paths fit the translation criteria. The relative part of the paths also get thrown away and the relative paths are replaced by their absolute equivalent. Performing absolute path conversion on both test paths ensure consistency across platforms of this test. The error was: error: PASS: bindings/python/bt2/test_python_bt2 6513 - test_name (test_plugin.PluginTestCase) c:/users/joraj/babeltrace/src/plugins/ctf/babeltrace-plugin-ctf.la c:/users/joraj/babeltrace/tests/../src/plugins not ok 6514 - test_path (test_plugin.PluginTestCase) FAIL: bindings/python/bt2/test_python_bt2 6514 - test_path (test_plugin.PluginTestCase) Traceback (most recent call last): bindings/python/bt2/test_python_bt2: Traceback (most recent call last): File "C:/msys64/mingw64/lib/python3.7\unittest\case.py", line 59, in testPartExecutor bindings/python/bt2/test_python_bt2: File "C:/msys64/mingw64/lib/python3.7\unittest\case.py", line 59, in testPartExecutor yield bindings/python/bt2/test_python_bt2: yield File "C:/msys64/mingw64/lib/python3.7\unittest\case.py", line 628, in run bindings/python/bt2/test_python_bt2: File "C:/msys64/mingw64/lib/python3.7\unittest\case.py", line 628, in run testMethod() bindings/python/bt2/test_python_bt2: testMethod() File "C:/Users/joraj/babeltrace/tests/bindings/python/bt2\test_plugin.py", line 96, in test_path bindings/python/bt2/test_python_bt2: File "C:/Users/joraj/babeltrace/tests/bindings/python/bt2\test_plugin.py", line 96, in test_path self.assertTrue(plugin_path.startswith(plugin_path_env)) bindings/python/bt2/test_python_bt2: self.assertTrue(plugin_path.startswith(plugin_path_env)) File "C:/msys64/mingw64/lib/python3.7\unittest\case.py", line 705, in assertTrue bindings/python/bt2/test_python_bt2: File "C:/msys64/mingw64/lib/python3.7\unittest\case.py", line 705, in assertTrue raise self.failureException(msg) bindings/python/bt2/test_python_bt2: raise self.failureException(msg) AssertionError: False is not true bindings/python/bt2/test_python_bt2: AssertionError: False is not true Change-Id: I4b3dc1c52a13dff5be88e417a9d1a877c81f66da Signed-off-by: Jonathan Rajotte Reviewed-on: https://review.lttng.org/c/babeltrace/+/1709 Reviewed-by: Philippe Proulx --- tests/bindings/python/bt2/test_plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/bindings/python/bt2/test_plugin.py b/tests/bindings/python/bt2/test_plugin.py index e0bf9451..9ba6cd9a 100644 --- a/tests/bindings/python/bt2/test_plugin.py +++ b/tests/bindings/python/bt2/test_plugin.py @@ -95,8 +95,8 @@ class PluginTestCase(unittest.TestCase): self.assertEqual(self._plugin.name, 'ctf') def test_path(self): - plugin_path = os.path.normcase(self._plugin.path) - plugin_path_env = os.path.normcase(_TEST_PLUGIN_PLUGINS_PATH) + plugin_path = os.path.abspath(os.path.normcase(self._plugin.path)) + plugin_path_env = os.path.abspath(os.path.normcase(_TEST_PLUGIN_PLUGINS_PATH)) self.assertTrue(plugin_path.startswith(plugin_path_env)) def test_author(self): -- 2.34.1