From bc3ac40cef584f03adef8da5dda53af8fb66e83d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Dausseur?= Date: Sat, 14 Feb 2026 13:29:22 +0100 Subject: [PATCH] Various fixes for windows --- doc/examples/example_conditional.tum | 3 +++ doc/examples/example_items.tum | 7 +++++-- doc/examples/example_plot.tum | 7 ++++++- .../test_items/test_item_console.py | 3 ++- .../test_report/report_export_html.py | 3 ++- .../items/common/conditional/test.tum | 6 ++++++ test/validation/items/console/test.tum | 19 +++++++++++++++++-- 7 files changed, 41 insertions(+), 7 deletions(-) diff --git a/doc/examples/example_conditional.tum b/doc/examples/example_conditional.tum index 7aaadf6..43552af 100644 --- a/doc/examples/example_conditional.tum +++ b/doc/examples/example_conditional.tum @@ -77,6 +77,9 @@ main: condition: <| $(conditional_exec) == 1 |> console_name: consname steps: +{% if os == "Windows" %} + - read_until: {expected: "echo 0", timeout: 0} +{% endif %} - read_until: {expected: "0", timeout: 0} - console: diff --git a/doc/examples/example_items.tum b/doc/examples/example_items.tum index 5a5fd90..a2aebcc 100644 --- a/doc/examples/example_items.tum +++ b/doc/examples/example_items.tum @@ -67,13 +67,16 @@ main: name: Console read_until immediate console_name: consname steps: - - read_until: {expected: "0", timeout: 0} +{% if os == "Windows" %} + - read_until: {expected: "echo 0", timeout: 1} +{% endif %} + - read_until: {expected: "0", timeout: 1} - console: name: Console read_until immediate (2) console_name: consname steps: - - read_until: {expected: "$(terminal_prompt)", timeout: 0} + - read_until: {expected: "$(terminal_prompt)", timeout: 1} - console: name: Console closure diff --git a/doc/examples/example_plot.tum b/doc/examples/example_plot.tum index 166ecb8..93a0688 100644 --- a/doc/examples/example_plot.tum +++ b/doc/examples/example_plot.tum @@ -13,8 +13,13 @@ main: - open: protocol: terminal terminal_path: $(test_directory) +{% if os == "Windows" %} + - writeln: mkdir "$(plot_log_path)" && echo Fini + - read_until: {expected: echo Fini, timeout: 1} +{% else %} - writeln: mkdir -p "$(plot_log_path)" && echo Fini - - read_until: {expected: Fini, timeout: 5} +{% endif %} + - read_until: {expected: Fini, timeout: 1} - console: name: Console closure diff --git a/src/testium/interpreter/test_items/test_item_console.py b/src/testium/interpreter/test_items/test_item_console.py index 984c0bc..4de4cf4 100644 --- a/src/testium/interpreter/test_items/test_item_console.py +++ b/src/testium/interpreter/test_items/test_item_console.py @@ -88,8 +88,9 @@ class TestItemConsoleOpen(TestItemConsoleAction): terminal_path = self._prms.getParam("terminal_path", processed=True) if terminal_path is not None: terminal_path = os.path.normpath(terminal_path) + default_shell = "cmd.exe" if tm.OS() == "Windows" else "/usr/bin/env bash" terminal_shell = self._prms.getParam( - "shell", default="/usr/bin/env bash", required=False, processed=True + "shell", default=default_shell, required=False, processed=True ) try: diff --git a/src/testium/interpreter/test_report/report_export_html.py b/src/testium/interpreter/test_report/report_export_html.py index 936ba66..023ec58 100644 --- a/src/testium/interpreter/test_report/report_export_html.py +++ b/src/testium/interpreter/test_report/report_export_html.py @@ -1,5 +1,6 @@ -import lxml +import lxml.html +import lxml.etree import html import interpreter.test_report.report_export as rpe import interpreter.test_report.test_report as tr diff --git a/test/validation/items/common/conditional/test.tum b/test/validation/items/common/conditional/test.tum index 571f567..22abc54 100644 --- a/test/validation/items/common/conditional/test.tum +++ b/test/validation/items/common/conditional/test.tum @@ -42,6 +42,9 @@ console_name: consname key: $(test)_PASS steps: +{% if os == "Windows" %} + - read_until: {expected: echo "terminal loaded", timeout: 1} +{% endif %} - read_until: {expected: terminal loaded, timeout: 5} - console: @@ -63,6 +66,9 @@ console_name: consname key: $(test)_PASS steps: +{% if os == "Windows" %} + - read_until: {expected: echo 0, timeout: 0} +{% endif %} - read_until: {expected: "0", timeout: 0} - console: diff --git a/test/validation/items/console/test.tum b/test/validation/items/console/test.tum index 6a10280..b59a959 100644 --- a/test/validation/items/console/test.tum +++ b/test/validation/items/console/test.tum @@ -8,14 +8,20 @@ - open: protocol: terminal terminal_path: $(test_directory) +{% if os == "Linux" %} - writeln: echo "endOfOpen" +{% endif %} - console: name: Console read_until with timeout console_name: term key: $(test)_PASS steps: +{% if os == "Linux" %} - read_until: {expected: endOfOpen, timeout: 5} +{% else %} + - read_until: {expected: $(terminal_prompt), timeout: 5} +{% endif %} - console: name: Console write @@ -33,6 +39,9 @@ console_name: term key: $(test)_PASS steps: +{% if os == "Windows" %} + - read_until: {expected: "echo 0", timeout: 0} +{% endif %} - read_until: {expected: "0", timeout: 0} - console: @@ -61,7 +70,7 @@ console_name: term key: $(test)_PASS steps: - - read_until: {expected: "Something never prints", timeout: 1, no_fail: true} + - read_until: {expected: Something never prints, timeout: 1, no_fail: true} - console: name: Console read_until muted @@ -69,7 +78,10 @@ key: $(test)_PASS steps: - writeln: echo "HelloConsole" - - read_until: {expected: "HelloConsole", timeout: 1, mute: true} +{% if os == "Windows" %} + - read_until: {expected: echo "HelloConsole", timeout: 1, mute: true} +{% endif %} + - read_until: {expected: HelloConsole, timeout: 1, mute: true} - console: name: Console read_until muted @@ -77,6 +89,9 @@ key: $(test)_PASS steps: - writeln: echo "HelloConsole is PASS" && echo "endOfCmd" +{% if os == "Windows" %} + - read_until: {expected: echo "endOfCmd", timeout: 1} +{% endif %} - read_until: {expected: endOfCmd, timeout: 1, process_result: "'Hello' in r'''$(result)''' and 'PASS' in r'''$(result)''' "} - console: