Skip to content

Commit 81c3260

Browse files
committed
Move zstd_support_multithread to tests and rename
1 parent e7840ad commit 81c3260

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Lib/compression/zstd/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,5 +240,3 @@ class Strategy(enum.IntEnum):
240240

241241
# Set CParameter/DParameter types for validity check
242242
_zstd._set_parameter_types(CParameter, DParameter)
243-
244-
zstd_support_multithread = CParameter.nb_workers.bounds() != (0, 0)

Lib/test/test_zstd/test_core.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
DParameter,
3838
Strategy,
3939
ZstdFile,
40-
zstd_support_multithread,
4140
)
4241

4342
_1K = 1024
@@ -65,8 +64,11 @@
6564

6665
TRAINED_DICT = None
6766

67+
SUPPORT_MULTITHREADING = False
6868

6969
def setUpModule():
70+
global SUPPORT_MULTITHREADING
71+
SUPPORT_MULTITHREADING = CParameter.nb_workers.bounds() != (0, 0)
7072
# uncompressed size 130KB, more than a zstd block.
7173
# with a frame epilogue, 4 bytes checksum.
7274
global DAT_130K_D
@@ -247,9 +249,9 @@ def test_compress_parameters(self):
247249
CParameter.checksum_flag : 1,
248250
CParameter.dict_id_flag : 0,
249251

250-
CParameter.nb_workers : 2 if zstd_support_multithread else 0,
251-
CParameter.job_size : 5*_1M if zstd_support_multithread else 0,
252-
CParameter.overlap_log : 9 if zstd_support_multithread else 0,
252+
CParameter.nb_workers : 2 if SUPPORT_MULTITHREADING else 0,
253+
CParameter.job_size : 5*_1M if SUPPORT_MULTITHREADING else 0,
254+
CParameter.overlap_log : 9 if SUPPORT_MULTITHREADING else 0,
253255
}
254256
ZstdCompressor(options=d)
255257

@@ -267,7 +269,7 @@ def test_compress_parameters(self):
267269
compress(b'', {CParameter.compression_level:level_min-1})
268270

269271
# zstd lib doesn't support MT compression
270-
if not zstd_support_multithread:
272+
if not SUPPORT_MULTITHREADING:
271273
with self.assertRaises(ZstdError):
272274
ZstdCompressor({CParameter.nb_workers:4})
273275
with self.assertRaises(ZstdError):
@@ -292,7 +294,7 @@ def test_unknown_compression_parameter(self):
292294
with self.assertRaisesRegex(ZstdError, pattern):
293295
ZstdCompressor(option)
294296

295-
@unittest.skipIf(True,#not zstd_support_multithread,
297+
@unittest.skipIf(not SUPPORT_MULTITHREADING,
296298
"zstd build doesn't support multi-threaded compression")
297299
def test_zstd_multithread_compress(self):
298300
size = 40*_1M

0 commit comments

Comments
 (0)