]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_resource.py
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Lib / test / test_resource.py
diff --git a/AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_resource.py b/AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_resource.py
deleted file mode 100644 (file)
index a874c0e..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-import unittest\r
-from test import test_support\r
-import time\r
-\r
-resource = test_support.import_module('resource')\r
-\r
-# This test is checking a few specific problem spots with the resource module.\r
-\r
-class ResourceTest(unittest.TestCase):\r
-\r
-    def test_args(self):\r
-        self.assertRaises(TypeError, resource.getrlimit)\r
-        self.assertRaises(TypeError, resource.getrlimit, 42, 42)\r
-        self.assertRaises(TypeError, resource.setrlimit)\r
-        self.assertRaises(TypeError, resource.setrlimit, 42, 42, 42)\r
-\r
-    def test_fsize_ismax(self):\r
-        try:\r
-            (cur, max) = resource.getrlimit(resource.RLIMIT_FSIZE)\r
-        except AttributeError:\r
-            pass\r
-        else:\r
-            # RLIMIT_FSIZE should be RLIM_INFINITY, which will be a really big\r
-            # number on a platform with large file support.  On these platforms,\r
-            # we need to test that the get/setrlimit functions properly convert\r
-            # the number to a C long long and that the conversion doesn't raise\r
-            # an error.\r
-            self.assertEqual(resource.RLIM_INFINITY, max)\r
-            resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max))\r
-\r
-    def test_fsize_enforced(self):\r
-        try:\r
-            (cur, max) = resource.getrlimit(resource.RLIMIT_FSIZE)\r
-        except AttributeError:\r
-            pass\r
-        else:\r
-            # Check to see what happens when the RLIMIT_FSIZE is small.  Some\r
-            # versions of Python were terminated by an uncaught SIGXFSZ, but\r
-            # pythonrun.c has been fixed to ignore that exception.  If so, the\r
-            # write() should return EFBIG when the limit is exceeded.\r
-\r
-            # At least one platform has an unlimited RLIMIT_FSIZE and attempts\r
-            # to change it raise ValueError instead.\r
-            try:\r
-                try:\r
-                    resource.setrlimit(resource.RLIMIT_FSIZE, (1024, max))\r
-                    limit_set = True\r
-                except ValueError:\r
-                    limit_set = False\r
-                f = open(test_support.TESTFN, "wb")\r
-                try:\r
-                    f.write("X" * 1024)\r
-                    try:\r
-                        f.write("Y")\r
-                        f.flush()\r
-                        # On some systems (e.g., Ubuntu on hppa) the flush()\r
-                        # doesn't always cause the exception, but the close()\r
-                        # does eventually.  Try flushing several times in\r
-                        # an attempt to ensure the file is really synced and\r
-                        # the exception raised.\r
-                        for i in range(5):\r
-                            time.sleep(.1)\r
-                            f.flush()\r
-                    except IOError:\r
-                        if not limit_set:\r
-                            raise\r
-                    if limit_set:\r
-                        # Close will attempt to flush the byte we wrote\r
-                        # Restore limit first to avoid getting a spurious error\r
-                        resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max))\r
-                finally:\r
-                    f.close()\r
-            finally:\r
-                if limit_set:\r
-                    resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max))\r
-                test_support.unlink(test_support.TESTFN)\r
-\r
-    def test_fsize_toobig(self):\r
-        # Be sure that setrlimit is checking for really large values\r
-        too_big = 10L**50\r
-        try:\r
-            (cur, max) = resource.getrlimit(resource.RLIMIT_FSIZE)\r
-        except AttributeError:\r
-            pass\r
-        else:\r
-            try:\r
-                resource.setrlimit(resource.RLIMIT_FSIZE, (too_big, max))\r
-            except (OverflowError, ValueError):\r
-                pass\r
-            try:\r
-                resource.setrlimit(resource.RLIMIT_FSIZE, (max, too_big))\r
-            except (OverflowError, ValueError):\r
-                pass\r
-\r
-    def test_getrusage(self):\r
-        self.assertRaises(TypeError, resource.getrusage)\r
-        self.assertRaises(TypeError, resource.getrusage, 42, 42)\r
-        usageself = resource.getrusage(resource.RUSAGE_SELF)\r
-        usagechildren = resource.getrusage(resource.RUSAGE_CHILDREN)\r
-        # May not be available on all systems.\r
-        try:\r
-            usageboth = resource.getrusage(resource.RUSAGE_BOTH)\r
-        except (ValueError, AttributeError):\r
-            pass\r
-\r
-def test_main(verbose=None):\r
-    test_support.run_unittest(ResourceTest)\r
-\r
-if __name__ == "__main__":\r
-    test_main()\r