mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
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.
This commit is contained in:
parent
6fc79bf813
commit
b7bd5df809
8 changed files with 169 additions and 26 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue