-
Notifications
You must be signed in to change notification settings - Fork 49
Ignore coverage of non-production code #1175
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
Conversation
Non-production code is only used in development and testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds # pragma: no cover comments to exclude command-line entry point functions from test coverage tracking. The PR description states these functions are only used in development and testing, not in production.
Key changes:
- Adds coverage exclusion pragmas to
argument_parser(),main(), andif __name__ == "__main__":blocks - Affects 9 frontend_tkinter module files that provide standalone testing/development entry points
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend_tkinter_template_overview.py | Adds coverage exclusions to argument parser, main function, and entry point |
| frontend_tkinter_stage_progress.py | Adds coverage exclusions to argument parser, main function, and entry point |
| frontend_tkinter_project_opener.py | Adds coverage exclusions to argument parser, main function, and entry point |
| frontend_tkinter_project_creator.py | Adds coverage exclusions to argument parser, main function, and entry point |
| frontend_tkinter_parameter_editor.py | Adds coverage exclusions to argument parser and entry point |
| frontend_tkinter_pair_tuple_combobox.py | Adds coverage exclusions to argument parser, main function, and entry point |
| frontend_tkinter_motor_test.py | Adds coverage exclusions to argument parser, main function, and entry point |
| frontend_tkinter_connection_selection.py | Adds coverage exclusions to argument parser, main function, and entry point |
| frontend_tkinter_component_editor_base.py | Adds coverage exclusion to entry point |
| frontend_tkinter_component_editor.py | Adds coverage exclusion to entry point |
|
|
||
|
|
||
| def argument_parser() -> argparse.Namespace: | ||
| def argument_parser() -> argparse.Namespace: # pragma: no cover |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The argument_parser function should not be excluded from coverage. This function is tested in tests/test_frontend_tkinter_template_overview.py (see test_argument_parser_loglevel_options), and excluding it from coverage will hide the fact that it has test coverage. Remove the pragma comment to allow coverage tracking for this tested function.
|
|
||
|
|
||
| def main() -> None: | ||
| def main() -> None: # pragma: no cover |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main function should not be excluded from coverage. This function is tested in tests/test_frontend_tkinter_template_overview.py (see test_main_function_logs_recently_used_directory_when_available and test_main_function_handles_no_recently_used_directories), and excluding it from coverage will hide the fact that it has test coverage. Remove the pragma comment to allow coverage tracking for this tested function.
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| if __name__ == "__main__": # pragma: no cover |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The if __name__ == "__main__" block should not be excluded from coverage. While this is typically used as an entry point, excluding it without evidence that it's never used in production or that tests exist that should bypass it is premature. Since the main() function it calls is tested, the coverage tool should be able to track whether this entry point is ever executed during testing.
|
|
||
|
|
||
| def argument_parser() -> Namespace: | ||
| def argument_parser() -> Namespace: # pragma: no cover |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The argument_parser function should not be excluded from coverage. This function is tested in tests/test_frontend_tkinter_motor_test.py (see test_argument_parser_wires_common_arguments), and excluding it from coverage will hide the fact that it has test coverage. Remove the pragma comment to allow coverage tracking for this tested function.
|
|
||
| # pylint: disable=duplicate-code | ||
| def main() -> None: | ||
| def main() -> None: # pragma: no cover |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main function should not be excluded from coverage. This function is tested in tests/test_frontend_tkinter_motor_test.py (see test_main_success_and_failure_paths), and excluding it from coverage will hide the fact that it has test coverage. Remove the pragma comment to allow coverage tracking for this tested function.
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| if __name__ == "__main__": # pragma: no cover |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The if __name__ == "__main__" block should not be excluded from coverage. While this is typically used as an entry point, excluding it without evidence that it's never used in production or that tests exist that should bypass it is premature. Since the main() function it calls is tested, the coverage tool should be able to track whether this entry point is ever executed during testing.
Non-production code is only used in development and testing