aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--test/py/conftest.py3
-rw-r--r--test/py/test_repo.py23
2 files changed, 21 insertions, 5 deletions
diff --git a/test/py/conftest.py b/test/py/conftest.py
index e087dd1..6102898 100644
--- a/test/py/conftest.py
+++ b/test/py/conftest.py
@@ -188,7 +188,8 @@ def client(client_cmd):
return client_cmd
-@fixture(params=[TestRepoOutputSimple, TestRepoOutputEmpty])
+@fixture(params=[TestRepoOutputSimple, TestRepoOutputEmpty],
+ ids=['output_simple', 'output_empty'])
def test_repo(tmp_path, request):
return request.param(os.path.join(tmp_path, 'repo'))
diff --git a/test/py/test_repo.py b/test/py/test_repo.py
index 76aeef3..f451e8f 100644
--- a/test/py/test_repo.py
+++ b/test/py/test_repo.py
@@ -57,14 +57,29 @@ def _test_repo_internal(env, repo, numof_processes, runs_per_process):
assert repo.run_output_matches(output), f"Output doesn't match: {output}"
-@pytest.mark.parametrize('numof_clients,runs_per_client',
- [(1, 1), (1, 2), (1, 10), (2, 1), (2, 10), (10, 1), (10, 10)])
+# Reference: https://github.com/pytest-dev/pytest/issues/3628
+# Automatic generation of readable test IDs.
+def my_parametrize(names, values, ids=None, **kwargs):
+ _names = names.split(',') if isinstance(names, str) else names
+ if not ids:
+ if len(_names) == 1:
+ ids = [f'{names}={v}' for v in values]
+ else:
+ ids = [
+ '-'.join(f'{k}={v}' for k, v in zip(_names, combination))
+ for combination in values
+ ]
+ return pytest.mark.parametrize(names, values, ids=ids, **kwargs)
+
+
+@my_parametrize('runs_per_client', [1, 5])
+@my_parametrize('numof_clients', [1, 5])
def test_repo(env, test_repo, numof_clients, runs_per_client):
_test_repo_internal(env, test_repo, numof_clients, runs_per_client)
@pytest.mark.stress
-@pytest.mark.parametrize('numof_clients,runs_per_client',
- [(1, 2000), (4, 500)])
+@my_parametrize(('numof_clients', 'runs_per_client'),
+ [(10, 50), (1, 2000), (4, 500)])
def test_repo_stress(env, test_repo, numof_clients, runs_per_client):
_test_repo_internal(env, test_repo, numof_clients, runs_per_client)