aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/py/test_repo.py
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-07-09 20:54:44 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-07-09 22:34:03 +0200
commitf43b435fddedc83e4c1fa709b90354e128b65416 (patch)
tree44032993fb89789ee9fd9f85cac01a3c7a0f105a /test/py/test_repo.py
parenttest: test empty CI run output, refactoring (diff)
downloadcimple-f43b435fddedc83e4c1fa709b90354e128b65416.tar.gz
cimple-f43b435fddedc83e4c1fa709b90354e128b65416.zip
test: prettier test names
Diffstat (limited to '')
-rw-r--r--test/py/test_repo.py23
1 files changed, 19 insertions, 4 deletions
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)