]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-149879: Fix test_resource on Cygwin (#149903) main
authorVictor Stinner <vstinner@python.org>
Fri, 15 May 2026 23:09:36 +0000 (01:09 +0200)
committerGitHub <noreply@github.com>
Fri, 15 May 2026 23:09:36 +0000 (23:09 +0000)
Setting RLIMIT_FSIZE or RLIMIT_CPU fails with EINVAL on Cygwin.

Lib/test/test_resource.py

index ba736b0806eb1b03b78c2f4a7d8a86f0d1c4f071..6ea27c463f3148462a9f3810dc5c42e65cf1bdff 100644 (file)
@@ -45,8 +45,8 @@ class ResourceTest(unittest.TestCase):
         resource.setrlimit(resource.RLIMIT_FSIZE, (max, max))
         resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max))
 
-    @unittest.skipIf(sys.platform == "vxworks",
-                     "setting RLIMIT_FSIZE is not supported on VxWorks")
+    @unittest.skipIf(sys.platform in ("vxworks", "cygwin"),
+                     f"setting RLIMIT_FSIZE is not supported on {sys.platform}")
     @unittest.skipUnless(hasattr(resource, 'RLIMIT_FSIZE'), 'requires resource.RLIMIT_FSIZE')
     def test_fsize_enforced(self):
         self.addCleanup(os_helper.unlink, os_helper.TESTFN)
@@ -84,8 +84,8 @@ class ResourceTest(unittest.TestCase):
         except (OverflowError, ValueError):
             pass
 
-    @unittest.skipIf(sys.platform == "vxworks",
-                     "setting RLIMIT_FSIZE is not supported on VxWorks")
+    @unittest.skipIf(sys.platform in ("vxworks", "cygwin"),
+                     f"setting RLIMIT_FSIZE is not supported on {sys.platform}")
     @unittest.skipUnless(hasattr(resource, 'RLIMIT_FSIZE'), 'requires resource.RLIMIT_FSIZE')
     def test_fsize_not_too_big(self):
         (cur, max) = resource.getrlimit(resource.RLIMIT_FSIZE)
@@ -163,8 +163,8 @@ class ResourceTest(unittest.TestCase):
             pass
 
     # Issue 6083: Reference counting bug
-    @unittest.skipIf(sys.platform == "vxworks",
-                     "setting RLIMIT_CPU is not supported on VxWorks")
+    @unittest.skipIf(sys.platform in ("vxworks", "cygwin"),
+                     f"setting RLIMIT_CPU is not supported on {sys.platform}")
     @unittest.skipUnless(hasattr(resource, 'RLIMIT_CPU'), 'requires resource.RLIMIT_CPU')
     def test_setrusage_refcount(self):
         limits = resource.getrlimit(resource.RLIMIT_CPU)