summaryrefslogtreecommitdiff
path: root/testing/tests
diff options
context:
space:
mode:
Diffstat (limited to 'testing/tests')
-rw-r--r--testing/tests/benchmarks/conftest.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/testing/tests/benchmarks/conftest.py b/testing/tests/benchmarks/conftest.py
index a9cc3464..1b99d96e 100644
--- a/testing/tests/benchmarks/conftest.py
+++ b/testing/tests/benchmarks/conftest.py
@@ -12,12 +12,30 @@ from leap.common.events import server
server.ensure_server()
+#
+# pytest customizations
+#
+
def pytest_addoption(parser):
parser.addoption(
"--num-docs", type="int", default=100,
help="the number of documents to use in performance tests")
+# mark benchmark tests using their group names (thanks ionelmc! :)
+def pytest_collection_modifyitems(items):
+ for item in items:
+ bench = item.get_marker("benchmark")
+ if bench and bench.kwargs.get('group'):
+ group = bench.kwargs['group']
+ marker = getattr(pytest.mark, 'benchmark_' + group)
+ item.add_marker(marker)
+
+
+#
+# benchmark fixtures
+#
+
@pytest.fixture()
def payload():
def generate(size):