`test_plugin.py`: use absolute paths for plugin path comparison
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Mon, 15 Jul 2019 21:50:11 +0000 (17:50 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 20 Jul 2019 13:37:47 +0000 (09:37 -0400)
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 <jonathan.rajotte-julien@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1709
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
tests/bindings/python/bt2/test_plugin.py

index e0bf945112d4760691f895953d8051f12cf49be7..9ba6cd9a197a263e82ec9f68056f41c604225368 100644 (file)
@@ -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):
This page took 0.02538 seconds and 4 git commands to generate.