Skip to content

Command-line test mode: return before console settings and devices - #1845

Open
dayfine wants to merge 1 commit into
PokemonAutomation:mainfrom
dayfine:upstream/headless-tests
Open

dayfine wants to merge 1 commit into
PokemonAutomation:mainfrom
dayfine:upstream/headless-tests

Conversation

@dayfine

@dayfine dayfine commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Command-line test mode now returns before the program loads the console settings, polls serial ports and cameras, or sets up device cleanup.

  • Tests need no console, serial port or camera. run_program() set all of these up before it checked --command-line-test-mode, so a test run could touch devices that another running instance holds
    • e.g. causing a running program to lose access to its controller and thus hung
  • This replaces the separate test executable this PR first proposed. With --test-substring from Command-line test runner: filter tests by name substring #1895, the existing binary can run tests alongside a running program.

Testing

  • --command-line-test-mode, with and without --test-substring: same pass/fail as main.
  • Ran it while another instance drove a Switch. The test run touched no ports or cameras, and the other instance kept its connection.

@dayfine dayfine changed the title Add SerialProgramsTests for running unit tests without the GUI Add SerialProgramsTests for running unit tests while running app Nov 4, 2026
@dayfine
dayfine marked this pull request as ready for review November 4, 2026 04:54
@dayfine

dayfine commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

remove use_qt_ui after #1856 merges

@dayfine

dayfine commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Possible direction if this PR feels too much as-is:

We can try fallback in the existing Main without a new executable. So do the test-mode check in Main.cpp ahead of the settings read and camera enumeration. That is about 10 lines and fixes the interference (when running tests with a living app). Just an idea, haven't verified it.

Tests need no console, serial port or camera. Loading the console settings,
polling serial ports and cameras, and the device cleanup ran before the
test-mode check, so a test run could touch devices another running instance
holds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
@dayfine
dayfine force-pushed the upstream/headless-tests branch from 1f0edf0 to a43df54 Compare November 12, 2026 06:57
@dayfine dayfine changed the title Add SerialProgramsTests for running unit tests while running app Command-line test mode: return before console settings and devices Nov 12, 2026
@dayfine

dayfine commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

Possible direction if this PR feels too much as-is:

We can try fallback in the existing Main without a new executable. So do the test-mode check in Main.cpp ahead of the settings read and camera enumeration. That is about 10 lines and fixes the interference (when running tests with a living app). Just an idea, haven't verified it.

simplified to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants