[Python-checkins] gh-103724: Add test case if no arg as provided in os.register_at_fork (gh-103725)

corona10 webhook-mailer at python.org
Sun Apr 23 19:14:21 EDT 2023


https://github.com/python/cpython/commit/7255bbd4a1841447a21c3eb74e4fd9e21818d833
commit: 7255bbd4a1841447a21c3eb74e4fd9e21818d833
branch: main
author: Ankit Kumar Pandey <93041495+itsankitkp at users.noreply.github.com>
committer: corona10 <donghee.na92 at gmail.com>
date: 2023-04-23T17:14:14-06:00
summary:

gh-103724: Add test case if no arg as provided in os.register_at_fork (gh-103725)

files:
M Lib/test/test_posix.py

diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index 77f42f7f9c93..444f8abe4607 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -231,6 +231,9 @@ def test_register_at_fork(self):
         with self.assertRaises(TypeError, msg="Invalid arg was allowed"):
             # Ensure a combination of valid and invalid is an error.
             os.register_at_fork(before=None, after_in_parent=lambda: 3)
+        with self.assertRaises(TypeError, msg="At least one argument is required"):
+            # when no arg is passed
+            os.register_at_fork()
         with self.assertRaises(TypeError, msg="Invalid arg was allowed"):
             # Ensure a combination of valid and invalid is an error.
             os.register_at_fork(before=lambda: None, after_in_child='')



More information about the Python-checkins mailing list