Files
François Dausseur 9dae210f7f fix(windows): UTF-8 console + self-sufficient validation wrapper
Make the suite run cleanly on Windows.

Product code:
- __init__.py: force UTF-8 on stdout/stderr. The Windows console code
  page (cp1252) cannot encode the box-drawing/accented characters the
  runner prints, which crashed the parent capture_stdout thread. Only
  the stream encoders are reconfigured; the locale default used to read
  cp1252 config files is left untouched.
- report_export_junit/html: open the report file with encoding="utf-8"
  (XML/HTML are UTF-8) instead of the platform default, matching the
  txt/json exporters.

Validation:
- run.bat: source mode now sets up its own venv and runs testium from
  src\ directly instead of delegating to the project run.bat (which
  launches the GUI and drops its arguments). Installs the fake_exporter
  entry-point plugin (report_plugin) and the [lsp] extra, and runs the
  same lsp_check.py pre-flight as run.sh.
- jsonrpc/test.tum: launch the echo server via "$(python_bin)" instead
  of "python3" (the Microsoft Store stub on Windows).
- post_execution.py: write the JUnit XML with encoding="utf-8".
- restore items/run/sub_pass.tum and sub_fail.tum, deleted by mistake in
  d97d00c "removed test logs".
2026-06-06 21:39:36 +02:00

334 lines
11 KiB
Plaintext

- console:
name: json rpc echo server
doc: check if jrpc_echo_server.py is available
console_name: jrpces
key: $(test)_PASS
steps:
- open:
protocol: terminal
- read_until: {expected: $(terminal_prompt), timeout: 1, no_fail: True}
- writeln: test -f {{include_directory}}/jrpc_echo_server.py && echo JRPC_OK
- read_until: {expected: JRPC_OK, timeout: 2, no_fail: True}
- group:
name: jsonrpc tests
condition: <| 'JRPC_OK' in r'''$(cn_json rpc echo server)''' |>
steps:
- console:
name: Start the json rpc echo server
console_name: jrpces
key: $(test)_PASS
steps:
- writeln: '"$(python_bin)" {{include_directory}}/jrpc_echo_server.py -c {{include_directory}}/jrpces.ini'
- read_until: {expected: ready, timeout: 5}
- console:
name: Open the raw tcp Console
skipped: $(skip_tcp)
console_name: jsonrpc_server
doc: Opening the RAW TCP console
key: $(test)_PASS
steps:
- open:
protocol: rawtcp
tcp_host: localhost
tcp_port: 4321
- json_rpc:
name: JSONRPC console Query waiting for reception
skipped: $(skip_tcp)
key: $(test)_PASS
console: {name : jsonrpc_server}
timeout: 1
steps:
- query:
method: echo
params:
- Hello World
- {a: 1, b: "hello"}
- json_rpc:
name: JSONRPC console Query not waiting (only send)
skipped: $(skip_tcp)
key: $(test)_PASS
console: {name : jsonrpc_server}
timeout: 1
steps:
- query:
method: echo
params:
- {b: "olleh", a: -1}
- World Hello
id: 3095372
no_wait: True
- sleep: {name: "Small delay for the test", timeout: 1, skipped: $(skip_tcp)}
- json_rpc:
name: JSONRPC console Reception
skipped: $(skip_tcp)
key: $(test)_PASS
console: {name : jsonrpc_server}
timeout: 1
steps:
- receive:
id: 3095372
- console:
name: Close the raw tcp console
skipped: $(skip_tcp)
console_name: jsonrpc_server
doc: Opening the RAW TCP console
key: $(test)_PASS
execute_on_stop: True
steps:
- close:
- json_rpc:
name: JSONRPC UDP query waiting for reception
key: $(test)_PASS
udp: {server: localhost, snd_port: 4323, rcv_port: 8765}
timeout: 1
steps:
- open:
- query:
name: echo
method: echo
params:
- Hello World
- {a: 1, b: "hello"}
timeout: 1
- close:
- json_rpc:
name: Failing JSONRPC UDP query waiting for reception (returning an error)
key: $(test)_FAIL
udp: {server: localhost, snd_port: 4323, rcv_port: 8765}
timeout: 1
steps:
- open:
- query:
method: echo2
params:
- Hello World
- {a: 1, b: "hello"}
timeout: 1
- close:
- json_rpc:
name: JSONRPC UDP query waiting for reception of an expected error
key: $(test)_PASS
udp: {server: localhost, snd_port: 4323, rcv_port: 8765}
timeout: 1
steps:
- open:
- query:
method: echo2
params:
- Hello World
- {a: 1, b: "hello"}
expected_result: {code: -32000, message: function not found}
- close:
- json_rpc:
name: Failing UDP JSONRPC query timeout elapses (wrong udp port)
doc: |
Failing JSONRPC UDP query waiting for reception and checking result
and timeout elapses (wrong udp port)
key: $(test)_FAIL
udp: {server: localhost, snd_port: 4326, rcv_port: 48393}
timeout: 1
steps:
- open:
- query:
method: echo
params:
- Hello World
- {a: 1, b: hello}
timeout: 0.5
- close:
- json_rpc:
name: JSONRPC UDP query not waiting (only send)
key: $(test)_PASS
udp: {server: localhost, snd_port: 4323, rcv_port: 8765}
timeout: 1
steps:
- open:
- query:
method: echo
params:
- {b: "olleh", a: -1}
- World Hello
id: 3095372
no_wait: True
- sleep: {name: "Small delay for the test", timeout: 1}
- json_rpc:
name: JSONRPC UDP Reception
key: $(test)_PASS
udp: {server: localhost, snd_port: 4323, rcv_port: 8765}
timeout: 1
steps:
- receive:
id: 3095372
- close:
- json_rpc:
name: JSONRPC UDP query not waiting (only send)
key: $(test)_PASS
udp: {server: localhost, snd_port: 4323, rcv_port: 8765}
timeout: 1
steps:
- open:
- query:
method: echo2
params:
- {b: "olleh", a: -1}
- World Hello
id: 3095372
no_wait: True
- sleep: {name: "Small delay for the test", timeout: 1}
- json_rpc:
name: Failing JSONRPC UDP Reception (returning an error)
key: $(test)_FAIL
udp: {server: localhost, snd_port: 4323, rcv_port: 8765}
timeout: 1
steps:
- receive:
id: 3095372
timeout: 1
- close:
- json_rpc:
name: UDP JSONRPC query waiting and checking
doc: JSONRPC UDP query waiting for reception and checking result
key: $(test)_PASS
udp: {server: localhost, snd_port: 4323, rcv_port: 48393}
timeout: 1
steps:
- open:
- query:
method: echo
params:
- Hello World
- {a: 1, b: hello}
expected_result: [[Hello World, {a: 1, b: hello}], {}]
timeout: 1
- close:
- json_rpc:
name: Failing UDP JSONRPC query waiting and checking
doc: JSONRPC UDP query waiting for reception and checking result
key: $(test)_FAIL
udp: {server: localhost, snd_port: 4323, rcv_port: 48393}
timeout: 1
steps:
- open:
- query:
method: echo
params:
- Hello World
- {a: 1, b: hello}
expected_result: [[], {}]
timeout: 1
- close:
- json_rpc:
name: UDP JSONRPC query not waiting (for checking)
doc: JSONRPC UDP query not waiting, with the purpose to check the result at reception
key: $(test)_PASS
udp: {server: localhost, snd_port: 4323, rcv_port: 9876}
timeout: 1
steps:
- open:
- query:
method: echo
params:
- {b: "olleh", a: -1}
- World Hello
id: 3095372
no_wait: True
- sleep: {name: "Small delay for the test", timeout: 1}
- json_rpc:
name: UDP JSONRPC reception checking
doc: JSONRPC UDP Reception and checking result
key: $(test)_PASS
udp: {server: localhost, snd_port: 4323, rcv_port: 9876}
timeout: 1
steps:
- receive:
id: 3095372
timeout: 1
expected_result: [[{b: olleh, a: -1}, World Hello], {}]
- close:
- json_rpc:
name: Failing UDP JSONRPC reception checking
doc: JSONRPC UDP Reception and checking result
key: $(test)_FAIL
udp: {server: localhost, snd_port: 4323, rcv_port: 9876}
timeout: 1
steps:
- receive:
id: 3095372
timeout: 1
expected_result: [[{b: ollhe, a: -1}, World Hello], {}]
- close:
- json_rpc:
name: UDP JSONRPC query waiting and evaluating result
doc: |
JSONRPC UDP query waiting for reception and checking result with
replacing $(result) and evaluating string.
key: $(test)_PASS
udp: {server: localhost, snd_port: 4323, rcv_port: 48393}
timeout: 1
steps:
- open:
- query:
method: echo
params:
- Hello World
- {a: 1, b: hello}
process_result: $(result)[0][1]['a']
expected_result: 1
timeout: 1
- close:
- json_rpc:
name: Failing UDP JSONRPC query waiting and evaluating result
doc: |
JSONRPC UDP query waiting for reception and checking result with
replacing $(result) and evaluating string.
key: $(test)_FAIL
udp: {server: localhost, snd_port: 4323, rcv_port: 48393}
timeout: 1
steps:
- open:
- query:
method: echo
params:
- Hello World
- {a: 1, b: hello}
expected_result: "$(result)[0][1]['a'] == 0"
timeout: 1
- close:
- console:
name: Stop json rpc echo server
doc: check if the jsonrpc echo server is installed
console_name: jrpces
execute_on_stop: True
key: $(test)_PASS
steps:
- close:
protocol: terminal