Skip to content

fix: NoReturn annotations on functions that actually return - #105

Open
andrewwhitecdw wants to merge 1 commit into
NVIDIA:mainfrom
andrewwhitecdw:bugfix/bobber-noreturn-annotations-on-functions-that
Open

fix: NoReturn annotations on functions that actually return#105
andrewwhitecdw wants to merge 1 commit into
NVIDIA:mainfrom
andrewwhitecdw:bugfix/bobber-noreturn-annotations-on-functions-that

Conversation

@andrewwhitecdw

Copy link
Copy Markdown

This PR addresses the following issue in bobber/bobber.py: NoReturn annotations on functions that actually return.

Changes

  • bobber/bobber.py: NoReturn annotations on functions that actually return.

Details

--- a/bobber/bobber.py
+++ b/bobber/bobber.py
@@ -244,7 +244,7 @@
     return Namespace(**settings)
 
 
-def save_config(args: Namespace) -> NoReturn:
+def save_config(args: Namespace) -> None:
     """
     Save the settings as JSON.
 
@@ -320,7 +320,7 @@
     return args
 
 
-def execute_command(args: Namespace, version: str) -> NoReturn:
+def execute_command(args: Namespace, version: str) -> None:
     """
     Execute a specific command from Bobber.
 
@@ -361,7 +361,7 @@
         run_tests.test_selector(args, version_underscore)
 
 
-def main() -> NoReturn:
+def main() -> None:
     """
     Launch a test with the Bobber framework.

Tests

  • tests/test_bobber_return_types.py
--- /dev/null
+++ b/tests/test_bobber_return_types.py
@@ -0,0 +1,16 @@
+import typing
+import unittest
+
+from bobber.bobber import execute_command, main, save_config
+
+
+class TestReturnTypeAnnotations(unittest.TestCase):
+    def test_no_no_return_annotations(self):
+        for func in (save_config, execute_command, main):
+            hints = typing.get_type_hints(func)
+            self.assertIsNot(
+                hints.get('return'), typing.NoReturn,
+                f'{func.__name__} should not be annotated as NoReturn'
+            )
+
+
+if __name__ == '__main__':
+    unittest.main()

Contributor guidelines

Per this repo's CONTRIBUTING.md:

  • All commits are signed off (Signed-off-by trailer, DCO).

Signed-off-by: Andrew White <andrewh@cdw.com>
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.

1 participant