fix: add runtime guards in BlockUnit and fix SubInfo bare except#19
Open
HugoFara wants to merge 3 commits intoTaskBeacon:mainfrom
Open
fix: add runtime guards in BlockUnit and fix SubInfo bare except#19HugoFara wants to merge 3 commits intoTaskBeacon:mainfrom
HugoFara wants to merge 3 commits intoTaskBeacon:mainfrom
Conversation
- Raise RuntimeError when run_trial() is called before generate_conditions() - Raise TypeError when trial function returns non-dict - Fix logging_block_info() calling .count() on numpy array - Replace bare except: with except Exception: in SubInfo.validate() - Add test_BlockUnit.py and test_SubInfo.py covering these paths
CI environment does not have numpy installed. Use a plain list instead of np.array() since enumerate() works on both.
The CI smoke job only installs pyyaml — numpy and psychopy are not available. Use skipUnless with a try-import guard instead of stubbing sys.modules, matching the existing pattern in test_cli_root.py.
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.
Hi @zh1peng , this PR fixes a few bugs I found in the app.
BlockUnit.run_trial(): Raise RuntimeError when run_trial() is called before generate_conditions() (previously crashed with opaque message)BlockUnit.run_trial(): raise TypeError when the trial function returns a non-dict (previously crashed with AttributeError: 'NoneType' object has no attribute 'update')BlockUnit.logging_block_info(): fix .count() call on numpy array (use np.sum() instead) and guard against conditions=NoneSubInfo.validate(): replace bare except: with except Exception: so KeyboardInterrupt propagates (Ctrl+C was beingswallowed)
I also included a few tests to check for regressions: