From 08acadae52d2da92e3a6607a89f0b7f81d2cea7c809c108194bcfa72b606cdf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20S=C3=BAkup?= Date: Tue, 10 Mar 2020 09:46:17 +0000 Subject: [PATCH] - add test_flaky.patch to fix gerkhin reporter test flakinness OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-bdd?expand=0&rev=8 --- python-pytest-bdd.changes | 1 + python-pytest-bdd.spec | 2 ++ test_flaky.patch | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 test_flaky.patch diff --git a/python-pytest-bdd.changes b/python-pytest-bdd.changes index 14a7072..3ab91fb 100644 --- a/python-pytest-bdd.changes +++ b/python-pytest-bdd.changes @@ -2,6 +2,7 @@ Tue Mar 10 09:40:32 UTC 2020 - Ondřej Súkup - use %pytest macro +- add test_flaky.patch to fix gerkhin reporter test flakinness ------------------------------------------------------------------- Mon Sep 9 14:09:26 UTC 2019 - Tomáš Chvátal diff --git a/python-pytest-bdd.spec b/python-pytest-bdd.spec index e591c86..738c72e 100644 --- a/python-pytest-bdd.spec +++ b/python-pytest-bdd.spec @@ -25,6 +25,7 @@ License: MIT Group: Development/Languages/Python URL: https://github.com/pytest-dev/pytest-bdd Source: https://github.com/pytest-dev/pytest-bdd/archive/%{version}.tar.gz#/pytest-bdd-%{version}.tar.gz +Patch0: test_flaky.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -74,6 +75,7 @@ containing the side effects of the Gherkin imperative declarations. %prep %setup -q -n pytest-bdd-%{version} +%patch0 -p1 sed -i '/tox/d' setup.py %build diff --git a/test_flaky.patch b/test_flaky.patch new file mode 100644 index 0000000..0454c61 --- /dev/null +++ b/test_flaky.patch @@ -0,0 +1,32 @@ +From 3f1ba96c2de855f96bda04cff8250f8c5a6095ed Mon Sep 17 00:00:00 2001 +From: Florian Bruhin +Date: Wed, 20 Nov 2019 22:19:18 +0100 +Subject: [PATCH] Fix gherkin terminal reporter test flakiness (#340) + +The test compares the output of two different reporters and tries to account for +the different runtime being printed. However, the output format changed with +pytest v5.1.0: + +https://docs.pytest.org/en/latest/changelog.html#id76 + +This changes the regex to be a bit more permissive. +--- + tests/feature/test_gherkin_terminal_reporter.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +Index: pytest-bdd-3.2.1/tests/feature/test_gherkin_terminal_reporter.py +=================================================================== +--- pytest-bdd-3.2.1.orig/tests/feature/test_gherkin_terminal_reporter.py ++++ pytest-bdd-3.2.1/tests/feature/test_gherkin_terminal_reporter.py +@@ -166,9 +166,9 @@ def output_must_be_the_same_as_regular_r + assert ghe.ret == 0 + # last line can be different because of test execution time is printed + reg_lines = reg.stdout.lines if reg.stdout.lines[-1] else reg.stdout.lines[:-2] +- reg_lines[-1] = re.sub(r' \d+\.\d+ ', ' X ', reg_lines[-1]) ++ reg_lines[-1] = re.sub(r" in [^=]*", " in X ", reg_lines[-1]) + ghe_lines = ghe.stdout.lines if ghe.stdout.lines[-1] else ghe.stdout.lines[:-2] +- ghe_lines[-1] = re.sub(r' \d+\.\d+ ', ' X ', ghe_lines[-1]) ++ ghe_lines[-1] = re.sub(r" in [^=]*", " in X ", ghe_lines[-1]) + for l1, l2 in zip(reg_lines, ghe_lines): + assert l1 == l2 +