Skip to content

Commit

Permalink
Don't run main() as a side effect of the import.
Browse files Browse the repository at this point in the history
This adds an import-time guard to ensure that `main()` isn't run twice
when command is run through the install-time shim.

Opted to leave this script in nav.bin, since it has pre-main setup
that isn't in the imported module.
  • Loading branch information
lunkwill42 committed Mar 20, 2024
1 parent f1e2bea commit 65996fa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion python/nav/bin/navtopology.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@

from nav.topology.detector import main

main()
if __name__ == '__main__':
main()

Check warning on line 9 in python/nav/bin/navtopology.py

View check run for this annotation

Codecov / codecov/patch

python/nav/bin/navtopology.py#L9

Added line #L9 was not covered by tests

0 comments on commit 65996fa

Please sign in to comment.