Skip to content

A skill to stop your coding agent from burying the answer. ADHD-friendly output.

tests: normalize path separators before comparing runtime outputs

Souptik Chakraborty53520b86dec2
diff --git a/tests/test_always_on_hooks.py b/tests/test_always_on_hooks.py
index d3cbbef..875320c 100644
--- a/tests/test_always_on_hooks.py
+++ b/tests/test_always_on_hooks.py
@@ -53,6 +53,13 @@ class AlwaysOnHookTest(unittest.TestCase):
env=env,
)
+ @staticmethod
+ def normalize(stdout):
+ # The banner embeds the flag path. On Windows the sh runtime joins it
+ # with "/" while node and PowerShell join with "\"; both name the same
+ # file, so unify separators (and newlines) before comparing runtimes.
+ return stdout.replace("\r\n", "\n").replace("\\", "/")
+
def test_hook_is_silent_without_opt_in_flag(self):
self.assertTrue(self.runtimes(), "no hook runtime is available")
@@ -74,7 +81,7 @@ class AlwaysOnHookTest(unittest.TestCase):
result = self.run_hook(command)
self.assertEqual(0, result.returncode)
self.assertEqual("", result.stderr)
- normalized = result.stdout.replace("\r\n", "\n")
+ normalized = self.normalize(result.stdout)
self.assertNotIn("name: fixture", normalized)
self.assertIn("\n\nFixture body.\n", normalized)
outputs[name] = normalized
@@ -95,7 +102,7 @@ class AlwaysOnHookTest(unittest.TestCase):
result = self.run_hook(command)
self.assertEqual(0, result.returncode)
self.assertEqual("", result.stderr)
- normalized = result.stdout.replace("\r\n", "\n")
+ normalized = self.normalize(result.stdout)
self.assertIn("Fixture body, fence never closed.", normalized)
outputs[name] = normalized