mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-25 23:01:09 -05:00
Fix two unit tests that failed at random on CI
The plugin-unload test of the automation suite and the in-flight tool call test of the Python script runner each failed now and then on a busy runner, macOS arm64 and Linux aarch64 in the last run, with nothing wrong in the app. Both pass however the runner schedules their threads.
This commit is contained in:
1 parent
efc29fdb80
commit
a0db07311b
2 files changed
+9
-3
No files matched your search
@@ -973,7 +973,7 @@ TEST_CASE("a tool call in flight when the run ends finishes before the run does"
|
||||
if (!harness.initialized)
|
||||
SKIP("Bundled Python interpreter unavailable: " + PythonInterpreter::instance().last_error());
|
||||
|
||||
SharedModule shared("_late", {"in_call"});
|
||||
SharedModule shared("_late", {"in_call", "done"});
|
||||
FakeBridge bridge;
|
||||
bridge.hook = [&](const std::string&, const json&) -> std::optional<json> {
|
||||
shared.set("in_call");
|
||||
@@ -983,10 +983,12 @@ TEST_CASE("a tool call in flight when the run ends finishes before the run does"
|
||||
ScopedToolBridge bound(bridge);
|
||||
const auto start = std::chrono::steady_clock::now();
|
||||
REQUIRE(run("import orca, threading, _late\n"
|
||||
"def work(orca=orca, late=_late):\n late.result = orca.host.tools.call('app_state')\n"
|
||||
"def work(orca=orca, late=_late):\n late.result = orca.host.tools.call('app_state')\n late.done.set()\n"
|
||||
"threading.Thread(target=work, daemon=True).start()\n_late.in_call.wait(10)\n")
|
||||
.status == "finished");
|
||||
CHECK(std::chrono::steady_clock::now() - start >= std::chrono::seconds(1));
|
||||
// The run waits for the call, not for the daemon thread that made it, which keeps the result once it runs again.
|
||||
REQUIRE(shared.wait("done", 5));
|
||||
CHECK(shared.get("result") == json{{"ready", true}});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user