PyFixate / Fixate

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

Fix the __main__ entry point. #202

Closed clint-lawrence closed 2 months ago

clint-lawrence commented 2 months ago

Because we were importing __main__ in __init__, we ended up with a warning that __main__ was already imported when it was executed as main. Moving the previous contents of __main__.py to main.py so that it can then be import in __init__.py and __main__.py fixes that.

clint-lawrence commented 2 months ago

@josh-marshall-amp the github diff makes it hard to review, but nothing has changed between main.py and main.py other than removing the if __name__ == "__main__" block from the bottom.

clint-lawrence commented 2 months ago

TIL - you can diff a renamed file across two branches:

> git diff master:./__main__.py ./main.py
diff --git a/src/fixate/__main__.py b/src/fixate/main.py
index f446c2c..d5db95a 100644
--- a/src/fixate/__main__.py
+++ b/src/fixate/main.py
@@ -424,8 +424,3 @@ def run_main_program(test_script_path=None, main_args=None):
     # Could this be replaced with a simple log_file variable in fixate.config ^ ?
     supervisor = FixateSupervisor(test_script_path, args)
     exit(supervisor.run_fixate())
-
-
-# Setup configuration
-if __name__ == "__main__":
-    run_main_program()