Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameterise sys args #197

Merged
merged 3 commits into from
Jul 22, 2024
Merged

Parameterise sys args #197

merged 3 commits into from
Jul 22, 2024

Conversation

josh-marshall-amp
Copy link
Contributor

Proof of concept... let test scripts act as their own runner.

if __name__ == "__main__":
    import fixate.__main__

    argv = ["-p", __file__, "--serial_number", "1234567890"]
    fixate.__main__.run_main_program(__file__, argv)

The only significant change was adding main_args to run_main_program(test_script_path=None, main_args=None), which has the same default behaviour, but if the args are passed in then it uses those instead of sys.argv.

I also added the argument parser build into its own function, and deglobalised parser.

Steps were being taken in this direction elsewhere, but it was quick enough to try out and make sure things don't break.

Copy link
Collaborator

@clint-lawrence clint-lawrence left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

I was thinking of this when doing the other work on the amptest run function, but didn't feel like a side quest at the time. We will also need add a cli flag to override the config file default, but that can wait for another day.

@josh-marshall-amp josh-marshall-amp marked this pull request as ready for review July 22, 2024 06:36
@josh-marshall-amp josh-marshall-amp merged commit 5c2fb64 into master Jul 22, 2024
9 checks passed
@clint-lawrence clint-lawrence deleted the parameterise-sys-args branch August 6, 2024 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants