From c6355f47129a18d303abb03aa6804346496f5b9b Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Mon, 12 Jan 2026 15:16:01 +0000 Subject: [PATCH 1/2] Fix a failing unit test on Windows Short of fixing Windows so it uses sensible path separators, this feels like a reasonable work-around. --- tests/test_fallback.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_fallback.py b/tests/test_fallback.py index 72654531..564eb733 100644 --- a/tests/test_fallback.py +++ b/tests/test_fallback.py @@ -187,5 +187,8 @@ def test_actual_server_fallback(): # The message from when the Thing errored should be displayed assert str(thing_error) in unescape(html) # With the traceback - assert 'labthings_fastapi/example_things/__init__.py", line' in unescape(html) + assert ( # The first line is true on *nix, the second is for Windows + 'labthings_fastapi/example_things/__init__.py", line' in unescape(html) + or 'labthings_fastapi\\example_things\\__init__.py", line' in unescape(html) + ) assert f'RuntimeError("{thing_error}")' in unescape(html) From ba819b6c6a72ee274c1fdd1ac68274a0956a889b Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Mon, 12 Jan 2026 16:29:07 +0000 Subject: [PATCH 2/2] Use os.path.join because it's neater This feels nicer than hard coding two strings for Linux/Windows. --- tests/test_fallback.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/test_fallback.py b/tests/test_fallback.py index 564eb733..56a367f1 100644 --- a/tests/test_fallback.py +++ b/tests/test_fallback.py @@ -6,6 +6,7 @@ """ import logging +import os import re from html import unescape @@ -186,9 +187,7 @@ def test_actual_server_fallback(): # The message from when the Thing errored should be displayed assert str(thing_error) in unescape(html) - # With the traceback - assert ( # The first line is true on *nix, the second is for Windows - 'labthings_fastapi/example_things/__init__.py", line' in unescape(html) - or 'labthings_fastapi\\example_things\\__init__.py", line' in unescape(html) - ) + # With the traceback (NB we need os.path.join to get correct slashes on Windows) + fpath = os.path.join("labthings_fastapi", "example_things", "__init__.py") + assert fpath in unescape(html) assert f'RuntimeError("{thing_error}")' in unescape(html)