PyFixate / Fixate

Framework for hardware test fixtures and automatic test environments
MIT License
22 stars 16 forks source link

Parameterise sys args #197

Closed josh-marshall-amp closed 2 months ago

josh-marshall-amp commented 2 months ago

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.