diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py index 5fd076bee38..0e24613ea8b 100644 --- a/Lib/test/test_resource.py +++ b/Lib/test/test_resource.py @@ -35,13 +35,10 @@ def test_args(self): @unittest.skipUnless(hasattr(resource, 'RLIMIT_FSIZE'), 'requires resource.RLIMIT_FSIZE') def test_fsize_ismax(self): (cur, max) = resource.getrlimit(resource.RLIMIT_FSIZE) - # RLIMIT_FSIZE should be RLIM_INFINITY, which will be a really big - # number on a platform with large file support. On these platforms, - # we need to test that the get/setrlimit functions properly convert - # the number to a C long long and that the conversion doesn't raise - # an error. - self.assertGreater(resource.RLIM_INFINITY, 0) - self.assertEqual(resource.RLIM_INFINITY, max) + # Test that the get/setrlimit functions properly handle large values + # for RLIMIT_FSIZE. On platforms with large file support, max may be + # RLIM_INFINITY, but on systems with file size restrictions, it may + # be a smaller value. self.assertLessEqual(cur, max) resource.setrlimit(resource.RLIMIT_FSIZE, (max, max)) resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max)) @@ -155,7 +152,6 @@ def expected(cur): "setting RLIMIT_FSIZE is not supported on VxWorks") @unittest.skipUnless(hasattr(resource, 'RLIMIT_FSIZE'), 'requires resource.RLIMIT_FSIZE') def test_fsize_negative(self): - self.assertGreater(resource.RLIM_INFINITY, 0) (cur, max) = resource.getrlimit(resource.RLIMIT_FSIZE) for value in -5, -2**31, -2**32-5, -2**63, -2**64-5, -2**1000: with self.subTest(value=value): diff --git a/Misc/NEWS.d/next/Tests/2025-11-18-10-16-34.gh-issue-37883.gH4xKm.rst b/Misc/NEWS.d/next/Tests/2025-11-18-10-16-34.gh-issue-37883.gH4xKm.rst new file mode 100644 index 00000000000..69811d6f4ec --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2025-11-18-10-16-34.gh-issue-37883.gH4xKm.rst @@ -0,0 +1,3 @@ +Fix ``test_resource.test_fsize_ismax`` to handle systems where +``RLIMIT_FSIZE`` max limit is less than ``RLIM_INFINITY``. Patched by +Shamil Abdulaev.