From 63c33b1b20e013571fb870205302bbc9e4a06e23 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Sat, 19 Nov 2016 21:52:30 -0300 Subject: [tests] use options instead of marks When we use marks the new pytests from benchmarks folder are collected and ignored, but this causes trial to fail sometimes. Using --ignore avoids it from being loaded while --benchmark-only will properly select the benchmarks for tox, as intended. --- testing/pytest.ini | 1 - testing/tests/benchmarks/test_crypto.py | 3 --- testing/tests/benchmarks/test_misc.py | 2 -- testing/tests/benchmarks/test_sqlcipher.py | 2 -- testing/tests/benchmarks/test_sync.py | 2 -- testing/tox.ini | 6 +++--- 6 files changed, 3 insertions(+), 13 deletions(-) diff --git a/testing/pytest.ini b/testing/pytest.ini index 9c9fc3b7..eb70b67c 100644 --- a/testing/pytest.ini +++ b/testing/pytest.ini @@ -1,4 +1,3 @@ [pytest] testpaths = tests twisted = yes -norecursedirs = tests/benchmarks diff --git a/testing/tests/benchmarks/test_crypto.py b/testing/tests/benchmarks/test_crypto.py index ab586bea..367c3b5b 100644 --- a/testing/tests/benchmarks/test_crypto.py +++ b/testing/tests/benchmarks/test_crypto.py @@ -18,9 +18,6 @@ from leap.soledad.client import _crypto LIMIT = int(float(os.environ.get('SIZE_LIMIT', 50 * 1000 * 1000))) -pytestmark = pytest.mark.benchmark - - def create_doc_encryption(size): @pytest.mark.benchmark(group="test_crypto_encrypt_doc") def test_doc_encryption(soledad_client, benchmark, payload): diff --git a/testing/tests/benchmarks/test_misc.py b/testing/tests/benchmarks/test_misc.py index 2f32ad7c..ead48adf 100644 --- a/testing/tests/benchmarks/test_misc.py +++ b/testing/tests/benchmarks/test_misc.py @@ -1,7 +1,5 @@ import pytest -pytestmark = pytest.mark.benchmark - @pytest.mark.benchmark(group="test_instance") def test_initialization(soledad_client, benchmark): diff --git a/testing/tests/benchmarks/test_sqlcipher.py b/testing/tests/benchmarks/test_sqlcipher.py index 7f8842bd..39c9e3ad 100644 --- a/testing/tests/benchmarks/test_sqlcipher.py +++ b/testing/tests/benchmarks/test_sqlcipher.py @@ -5,8 +5,6 @@ import pytest from twisted.internet.defer import gatherResults -pytestmark = pytest.mark.benchmark - def load_up(client, amount, payload, defer=True): results = [client.create_doc({'content': payload}) for _ in xrange(amount)] diff --git a/testing/tests/benchmarks/test_sync.py b/testing/tests/benchmarks/test_sync.py index 88afe9f8..1bf6cc21 100644 --- a/testing/tests/benchmarks/test_sync.py +++ b/testing/tests/benchmarks/test_sync.py @@ -1,7 +1,5 @@ import pytest -pytestmark = pytest.mark.benchmark - @pytest.inlineCallbacks def load_up(client, amount, payload): diff --git a/testing/tox.ini b/testing/tox.ini index f720d0a6..c46c6af1 100644 --- a/testing/tox.ini +++ b/testing/tox.ini @@ -4,7 +4,7 @@ skipsdist=True [testenv] basepython = python2.7 -commands = py.test -m "not benchmark" \ +commands = py.test --ignore=tests/benchmarks \ --cov-report=html \ --cov-report=term \ --cov=leap.soledad \ @@ -35,7 +35,7 @@ install_command = pip install {opts} {packages} deps = {[testenv]deps} pytest-benchmark -commands = py.test -m benchmark {posargs} +commands = py.test --benchmark-only {posargs} [testenv:code-check] changedir = .. @@ -51,4 +51,4 @@ deps = {[testenv]deps} pytest-xdist install_command = pip install {opts} {packages} -commands = py.test {posargs} -n 4 +commands = py.test --ignore=tests/benchmarks {posargs} -n 4 -- cgit v1.2.3