| 431 | |
| 432 | |
| 433 | def test_run_script_with_utf8_file(base_app, request) -> None: |
| 434 | test_dir = os.path.dirname(request.module.__file__) |
| 435 | filename = os.path.join(test_dir, "scripts", "utf8.txt") |
| 436 | |
| 437 | assert base_app._script_dir == [] |
| 438 | assert base_app._current_script_dir is None |
| 439 | |
| 440 | # Get output out the script |
| 441 | script_out, script_err = run_cmd(base_app, f"run_script {filename}") |
| 442 | assert base_app.last_result is True |
| 443 | |
| 444 | assert base_app._script_dir == [] |
| 445 | assert base_app._current_script_dir is None |
| 446 | |
| 447 | # Now run the commands manually and compare their output to script's |
| 448 | with open(filename, encoding="utf-8") as file: |
| 449 | script_commands = file.read().splitlines() |
| 450 | |
| 451 | manual_out = [] |
| 452 | manual_err = [] |
| 453 | for cmdline in script_commands: |
| 454 | out, err = run_cmd(base_app, cmdline) |
| 455 | manual_out.extend(out) |
| 456 | manual_err.extend(err) |
| 457 | |
| 458 | assert script_out == manual_out |
| 459 | assert script_err == manual_err |
| 460 | |
| 461 | |
| 462 | def test_scripts_add_to_history(base_app, request) -> None: |