From e167717208d6d52b5afa4cb625b8ccd44cd0de50 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 18 May 2017 13:50:44 -0300 Subject: [PATCH] Mark tests which use the graph_cases as "flaky" (pytest-rerunfailures) Related to #4 --- environment.yml | 1 + tests/conftest.py | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/environment.yml b/environment.yml index 63dce62..0fce268 100644 --- a/environment.yml +++ b/environment.yml @@ -13,6 +13,7 @@ dependencies: - pytest-qt - pytest-selenium - pytest-mock + - pytest-rerunfailures - pytest-xdist - pytest-xvfb diff --git a/tests/conftest.py b/tests/conftest.py index a5a2ea1..fdf0593 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -245,6 +245,19 @@ def graph_cases_factory(selenium): return lambda host: GraphCaseFactory(selenium=selenium, host=host) +def pytest_collection_modifyitems(items): + """ + Marks all tests which use the graph_cases fixture as "flaky". + + Unfortunately we've been unable to properly fix some flaky failures with tests using this fixture (#4)*. + + See pytest-rerunfailures plugin for more information. + """ + for item in items: + if 'graph_cases' in getattr(item, 'fixturenames', []): + item.add_marker(pytest.mark.flaky(reruns=3)) + + class GraphCaseFactory(object): """ Creates cases with graphs already preconfigured and with helper methods