summaryrefslogtreecommitdiff
path: root/testing/tests/benchmarks/conftest.py
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2017-03-01 13:39:04 -0300
committerVictor Shyba <victor1984@riseup.net>2017-03-02 18:54:32 -0300
commit6deadf8adeb8c6b4a98e2d69e2bf3b1447a6b4ca (patch)
tree5c2fffe214092429170db9965821bbe774559bd5 /testing/tests/benchmarks/conftest.py
parent5af57250f2b1cd174fa75c559bac6ea179c43d09 (diff)
[test] mark benchmark tests using their group names
Diffstat (limited to 'testing/tests/benchmarks/conftest.py')
-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):