diff --git a/pytest4.patch b/pytest4.patch new file mode 100644 index 0000000..938c5d0 --- /dev/null +++ b/pytest4.patch @@ -0,0 +1,44 @@ +From 812081b7bd8774ceb61016ac37da43107c26eea2 Mon Sep 17 00:00:00 2001 +From: Felix Yan +Date: Mon, 18 Feb 2019 02:15:55 +0800 +Subject: [PATCH] Fix tests under pytest 4 + +Pytest 4 removed support for calling fixtures directly: https://docs.pytest.org/en/latest/deprecations.html#calling-fixtures-directly + +This leads to an error when trying to run the tests: +``` +==================================== ERRORS ==================================== +_________________ ERROR collecting tests/test_bounding_box.py __________________ +Fixture "red" called directly. Fixtures are not meant to be called directly, +but are created automatically when test functions request them as parameters. +See https://docs.pytest.org/en/latest/fixture.html for more information about fixtures, and +https://docs.pytest.org/en/latest/deprecations.html#calling-fixtures-directly about how to update your code. +``` +--- + tests/test_bounding_box.py | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/tests/test_bounding_box.py b/tests/test_bounding_box.py +index f04c6da..e62a1ca 100644 +--- a/tests/test_bounding_box.py ++++ b/tests/test_bounding_box.py +@@ -8,7 +8,6 @@ + from redbaron import RedBaron + + +-@pytest.fixture + def red(): + return RedBaron("""\ + @deco +@@ -17,6 +16,11 @@ def a(c, d): + """) + + ++@pytest.fixture(name="red") ++def red_fixture(): ++ return red() ++ ++ + fst = red() + bounding_boxes = [ + (((1, 1), (4, 0)), ((1, 1), (4, 0)), fst), diff --git a/python-redbaron.changes b/python-redbaron.changes index 93b15c3..1398047 100644 --- a/python-redbaron.changes +++ b/python-redbaron.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Nov 1 12:53:22 UTC 2019 - Matej Cepl + +- Add pytest4.patch to make testsuite pass even with pytest 4 + (gh#PyCQA/redbaron#179) + ------------------------------------------------------------------- Thu Sep 5 13:40:10 UTC 2019 - Todd R diff --git a/python-redbaron.spec b/python-redbaron.spec index 1dbcdd4..8cb567c 100644 --- a/python-redbaron.spec +++ b/python-redbaron.spec @@ -25,7 +25,7 @@ License: LGPL-3.0-or-later Group: Development/Languages/Python URL: https://github.com/PyCQA/redbaron Source: https://files.pythonhosted.org/packages/source/r/redbaron/redbaron-%{version}.tar.gz -BuildRequires: %{python_module devel} +Patch0: pytest4.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -33,7 +33,7 @@ Requires: python-baron >= 0.7 BuildArch: noarch # SECTION test requirements BuildRequires: %{python_module baron >= 0.7} -BuildRequires: %{python_module pytest < 4} +BuildRequires: %{python_module pytest} # /SECTION %python_subpackages @@ -45,6 +45,7 @@ IPython. %prep %setup -q -n redbaron-%{version} +%autopatch -p1 %build %python_build