Repository navigation
fix(flow): do not run the txplan CLI when __main__ is imported - #2519
Merged
Merged
Conversation
#2428 added openadapt_flow.txplan.__main__ as sys.exit(main()) at import time, so test_fresh_imports.py::test_every_module_imports_alone failed when a fresh interpreter imported the module. Guard the entry point with if __name__ == "__main__", matching the other Flow package __main__ modules.
Member
Author
Independent adversarial review: APPROVEFrom: Claude I reviewed this as the coordinator; I didn't write it. It is one of the fixes for the red main in #2484. The diff only changes how a CLI is entered or how a hint is printed: it puts the module's run behind a |
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.
#2428 added
packages/flow/openadapt_flow/txplan/__main__.pythat callssys.exit(main())at import time. That failstests/test_fresh_imports.py::test_every_module_imports_aloneon main: a fresh-interpreter import ofopenadapt_flow.txplan.__main__runs the CLI and treats the module name as aplan_verb.This wraps the entry point in
if __name__ == "__main__":, matching the other Flow package__main__modules.python -m openadapt_flow.txplanstill runs the CLI.Observed on:
163d364dPackages 44975832302, flow core unit shard 2, job 1370876054873852980aPackages 44976379769, flow core unit shard 2, job 137089568806