summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2007-01-20 18:19:33 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2007-01-20 18:19:33 (GMT)
commit66262ab0644af6322e064e8bb3bbb8dd9cb3c2c6 (patch)
tree3da40215a31233362f43953381e275e99abc543b
parent9fab9a7da818fb5dcab6b95a76f7dfaf7111a461 (diff)
downloadcpython-66262ab0644af6322e064e8bb3bbb8dd9cb3c2c6.zip
cpython-66262ab0644af6322e064e8bb3bbb8dd9cb3c2c6.tar.gz
cpython-66262ab0644af6322e064e8bb3bbb8dd9cb3c2c6.tar.bz2
Add argument tests an calls of resource.getrusage().
-rw-r--r--Lib/test/test_resource.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py
index 4a61582..a3374d2 100644
--- a/Lib/test/test_resource.py
+++ b/Lib/test/test_resource.py
@@ -7,6 +7,13 @@ import os, resource
# This test is checking a few specific problem spots with the resource module.
class ResourceTest(unittest.TestCase):
+
+ def test_args(self):
+ self.assertRaises(TypeError, resource.getrlimit)
+ self.assertRaises(TypeError, resource.getrlimit, 42, 42)
+ self.assertRaises(TypeError, resource.setrlimit)
+ self.assertRaises(TypeError, resource.setrlimit, 42, 42, 42)
+
def test_fsize_ismax(self):
try:
@@ -71,6 +78,17 @@ class ResourceTest(unittest.TestCase):
except (OverflowError, ValueError):
pass
+ def test_getrusage(self):
+ self.assertRaises(TypeError, resource.getrusage)
+ self.assertRaises(TypeError, resource.getrusage, 42, 42)
+ usageself = resource.getrusage(resource.RUSAGE_SELF)
+ usagechildren = resource.getrusage(resource.RUSAGE_CHILDREN)
+ # May not be available on all systems.
+ try:
+ usageboth = resource.getrusage(resource.RUSAGE_BOTH)
+ except ValueError:
+ pass
+
def test_main(verbose=None):
test_support.run_unittest(ResourceTest)