summaryrefslogtreecommitdiff
path: root/Lib/test/test_resource.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-10-22 11:21:54 +0200
committerChristian Heimes <christian@cheimes.de>2013-10-22 11:21:54 +0200
commitb7bd5df809aabaf857eb51b139d5e519d8b3c364 (patch)
treed4fb23b4eca52906c84473365a6a0e44c792a7e4 /Lib/test/test_resource.py
parent6fc79bf813de21015208d989e38cdc95bda03292 (diff)
downloadcpython-git-b7bd5df809aabaf857eb51b139d5e519d8b3c364.tar.gz
Issue #16595: Add prlimit() to resource module
prlimit() is a Linux specific command that combines setrlimit, getrlimit and can set the limit of other processes.
Diffstat (limited to 'Lib/test/test_resource.py')
-rw-r--r--Lib/test/test_resource.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py
index 3c9c9a8292..950f4778be 100644
--- a/Lib/test/test_resource.py
+++ b/Lib/test/test_resource.py
@@ -139,6 +139,18 @@ class ResourceTest(unittest.TestCase):
self.assertIsInstance(resource.RLIMIT_SIGPENDING, int)
+ @unittest.skipUnless(hasattr(resource, 'prlimit'), 'no prlimit')
+ def test_prlimit(self):
+ self.assertRaises(TypeError, resource.prlimit)
+ self.assertRaises(PermissionError, resource.prlimit,
+ 1, resource.RLIMIT_AS)
+ self.assertRaises(ProcessLookupError, resource.prlimit,
+ -1, resource.RLIMIT_AS)
+ self.assertEqual(resource.prlimit(0, resource.RLIMIT_AS), (-1, -1))
+ self.assertEqual(resource.prlimit(0, resource.RLIMIT_AS, (-1, -1)),
+ (-1, -1))
+
+
def test_main(verbose=None):
support.run_unittest(ResourceTest)