[Python-checkins] r53505 - python/trunk/Lib/test/test_resource.py

walter.doerwald python-checkins at python.org
Sat Jan 20 19:19:34 CET 2007


Author: walter.doerwald
Date: Sat Jan 20 19:19:33 2007
New Revision: 53505

Modified:
   python/trunk/Lib/test/test_resource.py
Log:
Add argument tests an calls of resource.getrusage().


Modified: python/trunk/Lib/test/test_resource.py
==============================================================================
--- python/trunk/Lib/test/test_resource.py	(original)
+++ python/trunk/Lib/test/test_resource.py	Sat Jan 20 19:19:33 2007
@@ -7,6 +7,13 @@
 # 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 @@
             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)
 


More information about the Python-checkins mailing list