mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-26 07:11:23 -05:00
Stop testing that the early MCP command-line options are refused
The command-line test checked that four MCP options from before their rename are refused. They never shipped in a release, so the check guarded nothing a user could rely on, and on Windows it printed the app's full usage text into the sweep's console four times.
This commit is contained in:
1 parent
b595b8b02f
commit
3f314bad3f
4 files changed
+10
-34
No files matched your search
@@ -4756,7 +4756,7 @@ and `app_state.camera`, and a fit after the window was sized while no 3D view sh
|
||||
`tools/mcp/test_send_gcode.py` `printer_send`, `print_start`, `printer_test_host` and `app_state.uploads` against
|
||||
a stub print host that answers 200 or 500, `tools/mcp/test_printers.py` `printer_status` and the job
|
||||
commands' refusals with no printer connected, and the extruders of a two-extruder printer it installs,
|
||||
`tools/mcp/test_command_line.py` the command line's options (the refused ones, `--run`'s exit codes, folders and
|
||||
`tools/mcp/test_command_line.py` the command line's options (`--run`'s exit codes, folders and
|
||||
refusals, `--mcp-port`, the two run flags, and a run beside a window already open),
|
||||
`tools/mcp/test_runtime_lifecycle.py` the app's exit with a job, a recording or a call no stop interrupts still
|
||||
running and with the endpoint never opened, the server switched off and on during a call, and the GUI
|
||||
|
||||
+2
-2
@@ -168,8 +168,8 @@ the single-instance preference says, and it is refused with an action or `--down
|
||||
no GUI.
|
||||
|
||||
`test_command_line.py [--bin PATH] [CHECK ...]` checks that command line, starting the built app as its own
|
||||
child on fresh data folders: that the options it does not have are refused before any GUI starts, `--run`'s exit
|
||||
codes and folders, its refusal beside an action or `--downward-check`, that `--mcp-port` alone opens the server,
|
||||
child on fresh data folders: `--run`'s exit codes and folders, its refusal beside an action or `--downward-check`
|
||||
before any GUI starts, that `--mcp-port` alone opens the server,
|
||||
that `--unrestricted-scripts` and `--cad` hold for the run without writing the configuration, and a run beside a
|
||||
window already open on the same data folder. It prints one line per check and takes about two to three minutes.
|
||||
|
||||
|
||||
@@ -4,16 +4,15 @@ The design of this area's sweep tests. The rules every entry follows, the grades
|
||||
in [TESTS.md](../TESTS.md).
|
||||
|
||||
## `test_command_line`
|
||||
`test_command_line.py` · Python, 10 checks
|
||||
`test_command_line.py` · Python, 9 checks
|
||||
|
||||
**Tests:** OrcaSlicer's own command line. Each case starts the app as the test's child on a new data folder of its own (`launch: own`, `port-13694` lock, and the fixed port 13693 for a second window). It covers refused legacy options, `--run`'s exit codes and output folders for a replay and a script, `--run` refused beside a CLI action, `--mcp-port` opening the server, `--unrestricted-scripts` and `--cad` holding for one run only, `--run` beside a window already open, and single-instance hand-over per data folder.
|
||||
**Tests:** OrcaSlicer's own command line. Each case starts the app as the test's child on a new data folder of its own (`launch: own`, `port-13694` lock, and the fixed port 13693 for a second window). It covers `--run`'s exit codes and output folders for a replay and a script, `--run` refused beside a CLI action, `--mcp-port` opening the server, `--unrestricted-scripts` and `--cad` holding for one run only, `--run` beside a window already open, and single-instance hand-over per data folder.
|
||||
|
||||
**Starts from:** Data folders of its own, a new one per case, never a job's shared folder: `seed_datadir()` with the default printer, the Generic Klipper Printer 0.4 nozzle, with preset sync off and the update check sent to a port nothing answers, then the case's own conf values. No check reads a preset, and nothing here is a Bambu Lab printer's own. Its first start copies the Custom vendor's and the Orca Filament Library's profiles only (a Klipper folder was ready about 8 s after the launch on Windows, measured), well inside the 120 s limits.
|
||||
|
||||
**Leaves:** Nothing: each case's folder is deleted when the case ends, retried while WebView2's processes let go of its files.
|
||||
|
||||
**Decides by:** Exits 1 when any check prints FAIL. Each check collects problems from exit codes, stderr text, files on disk and a few MCP reads.
|
||||
- `refused_options`: `--mcp-run`, `--mcp-run-out`, `--mcp-token` and `--no-mcp` each exit non-zero within 10 s, with "Invalid option" on stderr. The data folder holds only `OrcaSlicer.conf`.
|
||||
- `run_invalid_file`: the exit code is exactly 2 for a missing `.json` and for a `.txt`.
|
||||
- `run_replay_folders`, `run_script_output_folder`: each run exits 0. `result.json` is in `r.out`, or only in `--outputdir`. Exactly one `.png` lands in `--outputdir` or in `<datadir>/automation/out`, none in the other, and `<datadir>/mcp/out` does not exist.
|
||||
- `run_refused_without_gui`: the exit code is -2 or 254, stderr has "--run cannot be combined with <option>", and the data folder holds only the conf and `result.json`.
|
||||
@@ -25,7 +24,7 @@ in [TESTS.md](../TESTS.md).
|
||||
|
||||
**Not checked:**
|
||||
- Outside `cad_flag`, the exit code `App.quit()` returns is dropped, so a crash or hang on File > Quit fails no other check.
|
||||
- `refused_options` accepts any non-zero code, and `run_invalid_file` any cause of exit 2. `run_refused_without_gui` says the refusal's reason goes to `result.json` but never reads it. `run_replay_folders` checks that `result.json` exists, not what it says.
|
||||
- `run_invalid_file` accepts any cause of exit 2. `run_refused_without_gui` says the refusal's reason goes to `result.json` but never reads it. `run_replay_folders` checks that `result.json` exists, not what it says.
|
||||
- `unrestricted_scripts_flag` takes exit 1 without the flag as the refusal. Any other script failure also exits 1, but the same script passed with the flag.
|
||||
- `run_beside_open_window` reads nothing in the first window after the run; what shows the run stayed out of it is the run's own `result.json` and exit code.
|
||||
- On Linux, `window_per_data_folder` checks only the exit code, not that the first window loaded the model. The Windows-only spellings never run elsewhere, and the check stops at the first spelling that fails.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Checks OrcaSlicer's command line: the options it refuses, what --run does with its file and its folders, where --run
|
||||
is refused, what --mcp-port opens, the two flags that hold for one run, a run beside a window already open, and a
|
||||
window on another data folder.
|
||||
"""Checks OrcaSlicer's command line: what --run does with its file and its folders, where --run is refused, what
|
||||
--mcp-port opens, the two flags that hold for one run, a run beside a window already open, and a window on another
|
||||
data folder.
|
||||
|
||||
Each check starts the built app as this script's child, on a fresh data folder with a short path under the temporary
|
||||
folder, seeded as orca_mcp.py launch seeds one, with preset sync off and the update check sent to the loopback's
|
||||
@@ -9,9 +9,6 @@ written by the check into a temporary folder of its own. An app that serves is c
|
||||
on the File menu's Quit item that widget_list lists; an app still running when its check is done is killed with its
|
||||
child processes.
|
||||
|
||||
- refused_options: --mcp-run r.json, --mcp-run-out d, --mcp-token t and --no-mcp each exit non-zero within 10 s with
|
||||
"Invalid option" on stderr, and the data folder holds only the seeded OrcaSlicer.conf, which a GUI that started
|
||||
would have added its log and cache folders to.
|
||||
- run_invalid_file: --run missing.json exits 2, and so does --run a.txt, whose text is a valid replay.
|
||||
- run_replay_folders: --run r.json, a replay whose one step is app_state, exits 0 with result.json in r.out beside
|
||||
it; with --outputdir D, a folder that does not exist yet, it exits 0, D holds result.json, and r.out is not created.
|
||||
@@ -250,26 +247,6 @@ class App:
|
||||
self.kill()
|
||||
|
||||
|
||||
def refused_options(binary):
|
||||
problems = []
|
||||
for label, args in (("--mcp-run r.json", lambda work: ["--mcp-run", work.file("r.json", json.dumps(REPLAY))]),
|
||||
("--mcp-run-out d", lambda work: ["--mcp-run-out", work.file("d")]),
|
||||
("--mcp-token t", lambda work: ["--mcp-token", "t"]),
|
||||
("--no-mcp", lambda work: ["--no-mcp"])):
|
||||
with Work() as work:
|
||||
app = work.start(binary, *args(work))
|
||||
code = app.wait(REFUSE_LIMIT_S)
|
||||
if code is None:
|
||||
problems.append(f"{label}: still running {REFUSE_LIMIT_S} s after its start")
|
||||
elif code == 0:
|
||||
problems.append(f"{label}: exit code 0")
|
||||
if "Invalid option" not in app.stderr():
|
||||
problems.append(f"{label}: no \"Invalid option\" on stderr")
|
||||
if (gui := work.only_conf_in_datadir()) is not None:
|
||||
problems.append(f"{label}: {gui}")
|
||||
check("refused_options", problems, "each exits non-zero within 10 s with \"Invalid option\" and no GUI")
|
||||
|
||||
|
||||
def run_invalid_file(binary):
|
||||
problems = []
|
||||
with Work() as work:
|
||||
@@ -532,7 +509,7 @@ def window_per_data_folder(binary):
|
||||
"served beside it")
|
||||
|
||||
|
||||
CHECKS = {f.__name__: f for f in (refused_options, run_invalid_file, run_replay_folders, run_script_output_folder,
|
||||
CHECKS = {f.__name__: f for f in (run_invalid_file, run_replay_folders, run_script_output_folder,
|
||||
run_refused_without_gui, mcp_port_opens_endpoint, unrestricted_scripts_flag, cad_flag,
|
||||
run_beside_open_window, window_per_data_folder)}
|
||||
|
||||
|
||||
Reference in new issue
Block a user