]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-136315: Fix skipped multithreading test in test_zstd (#136320)
authorEmma Smith <emma@emmatyping.dev>
Sat, 5 Jul 2025 17:32:28 +0000 (10:32 -0700)
committerGitHub <noreply@github.com>
Sat, 5 Jul 2025 17:32:28 +0000 (17:32 +0000)
Fix skipped test in test_zstd

Lib/test/test_zstd.py

index d4c28aed38ef908891f10368f7bd547fe1c8fb8a..90b2adc9665480e3983c16576022e09b22abaee5 100644 (file)
@@ -62,15 +62,18 @@ SAMPLES = None
 
 TRAINED_DICT = None
 
-SUPPORT_MULTITHREADING = False
+# Cannot be deferred to setup as it is used to check whether or not to skip
+# tests
+try:
+    SUPPORT_MULTITHREADING = CompressionParameter.nb_workers.bounds() != (0, 0)
+except Exception:
+    SUPPORT_MULTITHREADING = False
 
 C_INT_MIN = -(2**31)
 C_INT_MAX = (2**31) - 1
 
 
 def setUpModule():
-    global SUPPORT_MULTITHREADING
-    SUPPORT_MULTITHREADING = CompressionParameter.nb_workers.bounds() != (0, 0)
     # uncompressed size 130KB, more than a zstd block.
     # with a frame epilogue, 4 bytes checksum.
     global DAT_130K_D