summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_lzma.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-08-25 09:37:27 (GMT)
committerGitHub <noreply@github.com>2023-08-25 09:37:27 (GMT)
commit4ae3edf3008b70e20663143553a736d80ff3a501 (patch)
treecfff26206d6f63f057307caff13a6062b2238c6c /Lib/test/test_lzma.py
parente59a95238b76f518e936b6e70da9207d923964db (diff)
downloadcpython-4ae3edf3008b70e20663143553a736d80ff3a501.zip
cpython-4ae3edf3008b70e20663143553a736d80ff3a501.tar.gz
cpython-4ae3edf3008b70e20663143553a736d80ff3a501.tar.bz2
gh-108418: Speed up bigmem compression tests in dry mode (GH-108419)
Only generate and compress small amount of random data in dry run.
Diffstat (limited to 'Lib/test/test_lzma.py')
-rw-r--r--Lib/test/test_lzma.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/test_lzma.py b/Lib/test/test_lzma.py
index ac53bdd..13b2009 100644
--- a/Lib/test/test_lzma.py
+++ b/Lib/test/test_lzma.py
@@ -352,10 +352,10 @@ class CompressorDecompressorTestCase(unittest.TestCase):
@bigmemtest(size=_4G + 100, memuse=3)
def test_decompressor_bigmem(self, size):
lzd = LZMADecompressor()
- blocksize = 10 * 1024 * 1024
+ blocksize = min(10 * 1024 * 1024, size)
block = random.randbytes(blocksize)
try:
- input = block * (size // blocksize + 1)
+ input = block * ((size-1) // blocksize + 1)
cdata = lzma.compress(input)
ddata = lzd.decompress(cdata)
self.assertEqual(ddata, input)