Skip to content

Commit 77c932b

Browse files
committed
gh-37883: Fix test_resource.test_fsize_ismax for systems with limited file sizes
1 parent 630cd37 commit 77c932b

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

Lib/test/test_resource.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,10 @@ def test_args(self):
3535
@unittest.skipUnless(hasattr(resource, 'RLIMIT_FSIZE'), 'requires resource.RLIMIT_FSIZE')
3636
def test_fsize_ismax(self):
3737
(cur, max) = resource.getrlimit(resource.RLIMIT_FSIZE)
38-
# RLIMIT_FSIZE should be RLIM_INFINITY, which will be a really big
39-
# number on a platform with large file support. On these platforms,
40-
# we need to test that the get/setrlimit functions properly convert
41-
# the number to a C long long and that the conversion doesn't raise
42-
# an error.
43-
self.assertGreater(resource.RLIM_INFINITY, 0)
44-
self.assertEqual(resource.RLIM_INFINITY, max)
38+
# Test that the get/setrlimit functions properly handle large values
39+
# for RLIMIT_FSIZE. On platforms with large file support, max may be
40+
# RLIM_INFINITY, but on systems with file size restrictions, it may
41+
# be a smaller value.
4542
self.assertLessEqual(cur, max)
4643
resource.setrlimit(resource.RLIMIT_FSIZE, (max, max))
4744
resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max))
@@ -155,7 +152,6 @@ def expected(cur):
155152
"setting RLIMIT_FSIZE is not supported on VxWorks")
156153
@unittest.skipUnless(hasattr(resource, 'RLIMIT_FSIZE'), 'requires resource.RLIMIT_FSIZE')
157154
def test_fsize_negative(self):
158-
self.assertGreater(resource.RLIM_INFINITY, 0)
159155
(cur, max) = resource.getrlimit(resource.RLIMIT_FSIZE)
160156
for value in -5, -2**31, -2**32-5, -2**63, -2**64-5, -2**1000:
161157
with self.subTest(value=value):
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix ``test_resource.test_fsize_ismax`` to handle systems where
2+
``RLIMIT_FSIZE`` max limit is less than ``RLIM_INFINITY``. Patched by
3+
Shamil Abdulaev.

0 commit comments

Comments
 (0)