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

Fix the __main__ entry point. #202

Merged
merged 2 commits into from
Jul 24, 2024
Merged

Fix the __main__ entry point. #202

merged 2 commits into from
Jul 24, 2024

Conversation

clint-lawrence
Copy link
Collaborator

@clint-lawrence clint-lawrence commented Jul 23, 2024

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.

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
Copy link
Collaborator Author

@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
Copy link
Collaborator Author

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()

Copy link
Contributor

@josh-marshall-amp josh-marshall-amp left a comment

Choose a reason for hiding this comment

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

good stuff

@clint-lawrence clint-lawrence merged commit ce3284d into master Jul 24, 2024
10 checks passed
@clint-lawrence clint-lawrence deleted the fix-main branch July 24, 2024 00:28
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.

3 participants