summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/test/test_resource.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py
index 950f477..239d8d5 100644
--- a/Lib/test/test_resource.py
+++ b/Lib/test/test_resource.py
@@ -1,4 +1,5 @@
import sys
+import os
import unittest
from test import support
import time
@@ -142,13 +143,15 @@ class ResourceTest(unittest.TestCase):
@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)
+ if os.geteuid() != 0:
+ 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))
+ limit = resource.getrlimit(resource.RLIMIT_AS)
+ self.assertEqual(resource.prlimit(0, resource.RLIMIT_AS), limit)
+ self.assertEqual(resource.prlimit(0, resource.RLIMIT_AS, limit),
+ limit)
def test_main(verbose=None):