Add ids to data params to avoid exploding PYTEST_CURRENT_TEST
If ids are not specified for fixture params then pytest embeds
them directly in the PYTEST_CURRENT_TEST environment variable.
This causes problems when those parameters are large, as data
is, particularly on MS Windows where env vars are limited to
32 kB in length.
@@ -4,13 +4,16 @@ from multiprocessing.pool import ThreadPool
import os
import pytest
-
-@pytest.fixture(
- params=[
+test_data=[
(b''),
(os.urandom(128 * 1024)),
(b'0' * 128 * 1024),
]
+@pytest.fixture(
+ params=test_data,
+ ids=[
+ 'data' + str(i) for i in range(len(test_data))
+ ]
)
def data(request):
return request.param
