| 96 | |
| 97 | |
| 98 | def test_scripts_add_to_history(base_app, request) -> None: |
| 99 | test_dir = os.path.dirname(request.module.__file__) |
| 100 | python_script = os.path.join(test_dir, "pyscript", "help.py") |
| 101 | command = f"run_pyscript {python_script}" |
| 102 | |
| 103 | # Add to history |
| 104 | base_app.scripts_add_to_history = True |
| 105 | base_app.history.clear() |
| 106 | run_cmd(base_app, command) |
| 107 | assert len(base_app.history) == 2 |
| 108 | assert base_app.history.get(1).raw == command |
| 109 | assert base_app.history.get(2).raw == "help" |
| 110 | |
| 111 | # Do not add to history |
| 112 | base_app.scripts_add_to_history = False |
| 113 | base_app.history.clear() |
| 114 | run_cmd(base_app, command) |
| 115 | assert len(base_app.history) == 1 |
| 116 | assert base_app.history.get(1).raw == command |
| 117 | |
| 118 | |
| 119 | def test_run_pyscript_dir(base_app, request) -> None: |