Unit testing BpodSystem and protocol running locally and on GitHub Actions#37
Open
ogeesan wants to merge 43 commits intosanworks:developfrom
Open
Unit testing BpodSystem and protocol running locally and on GitHub Actions#37ogeesan wants to merge 43 commits intosanworks:developfrom
ogeesan wants to merge 43 commits intosanworks:developfrom
Conversation
Prior to this the code assumed the protocol folder was in the top-level of the Protocols folder, meaning that the folders for the protocol would not be removed from the Path if it was a nested protocol.
If no COM is found the emulator dialog box is launched, and then the rest of the function runs. In that situation no BpodSystem is created and so the attempt to report on the calibration table fails.
The environment setup doesn't retain the path?
GH Actions says fileparts(which('Bpod')) is '/home/runner/work/Bpod_Gen2/Bpod_Gen2/Functions/Internal Functions/', so let's use the self-fixing function instead.
Weirder and more wonderful tests will require better construction patterns
Required to make tests run through without manual intervention.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces an integration test that runs a protocol in GitHub Actions, testing that a key user operation and all of the code components required to make it happen are able to integrate together.
This PR does three main things.
RunProtocoland theLaunchManagerinto de-coupled pieces (i.e. noglobal BpodSystem), enabling usage in unit-testing.Launcher refactor
The old behaviour was:
BpodSystem.GUIHandles.RunButtonrunsRunProtocol('StartPause')RunProtocol('StartPause')will runLaunchManager(if Bpod not being used)LaunchManagercreates the GUILaunchManager.launch_protocol()prepares state machine and callsrun()to run the protocol (the function being similar toRunProtocol('Start'))The repeated code in
RunProtocol()andLaunchManagerhave been refactored, and now both callBpodLib.launcher.launchProtocol()to start a protocol.Test Bpod
By creating a
BpodObjectwithout usingInitializeGUI()we can get various runs to work on GitHub Actions. Using~isempty(BpodSystem.GUIHandles)is used to make updating the GUI conditional on there being a GUI at all.Protocol testing
Being able to run a protocol from start to finish serves as a good canary in the coal-mine for the testing suite. Our test coverage isn't very high right now, but by testing that many of the pieces are able to function together in their expected usage gives some good peace of mind.
Tests/assets/now contains two protocols.BpodSettingsGUI) and therefore can only run locally