From 5d6d3666269e1d7c4508569b318ef8e8b06b3e40 Mon Sep 17 00:00:00 2001 From: Jakub Bogusz Date: Mon, 28 Mar 2022 18:58:12 +0200 Subject: [PATCH] - disable pytest plugins - added noconf patch for sphinx 4.x compatibility --- python-sphinxtesters-noconf.patch | 33 +++++++++++++++++++++++++++++++ python-sphinxtesters.spec | 14 ++++++++++--- 2 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 python-sphinxtesters-noconf.patch diff --git a/python-sphinxtesters-noconf.patch b/python-sphinxtesters-noconf.patch new file mode 100644 index 0000000..9e947a3 --- /dev/null +++ b/python-sphinxtesters-noconf.patch @@ -0,0 +1,33 @@ +--- sphinxtesters-0.2.3/sphinxtesters/tests/test_pagebuilder.py.orig 2019-08-07 00:44:39.000000000 +0200 ++++ sphinxtesters-0.2.3/sphinxtesters/tests/test_pagebuilder.py 2022-03-28 16:50:58.786025816 +0200 +@@ -3,10 +3,14 @@ + + from os.path import (dirname, join as pjoin, isdir, isfile) + ++from sphinx.errors import ConfigError ++ ++NO_CONFIG_ERRORS = (IOError, ConfigError) + try: # Sphinx 1.8.0b1 +- from sphinx.errors import ApplicationError as NoConfigError ++ from sphinx.errors import ApplicationError ++ NO_CONFIG_ERRORS = (IOError, ConfigError, ApplicationError) + except ImportError: +- from sphinx.errors import ConfigError as NoConfigError ++ pass + + from sphinxtesters.sphinxutils import PageBuilder + +@@ -81,10 +85,10 @@ def test_bad_pagebuilder(): + def set_page_source(cls): + cls.page_source = HERE + +- # ConfigError as of Sphinx 1.6.6 +- # ApplicationError as of 1.8.0b1 ++ # ConfigError as of Sphinx 1.6.6 or 4.5.0 ++ # ApplicationError as of 1.8.0b1-3.5.x + # See imports. +- with pytest.raises((IOError, NoConfigError)): ++ with pytest.raises(NO_CONFIG_ERRORS): + TestBadPageBuilder.setup_class() + + diff --git a/python-sphinxtesters.spec b/python-sphinxtesters.spec index be2534b..d4f3c8d 100644 --- a/python-sphinxtesters.spec +++ b/python-sphinxtesters.spec @@ -1,6 +1,6 @@ # # Conditional build: -%bcond_without tests # unit tests +%bcond_without tests # unit tests [py3 tests fail with sphinx3.x+docutils0.18 combo] %bcond_without python2 # CPython 2.x module %bcond_without python3 # CPython 3.x module @@ -14,6 +14,7 @@ Group: Libraries/Python #Source0Download: https://pypi.org/simple/sphinxtesters/ Source0: https://files.pythonhosted.org/packages/source/s/sphinxtesters/sphinxtesters-%{version}.tar.gz # Source0-md5: 3df3720ba757d3d8270fed5aff622852 +Patch0: %{name}-noconf.patch URL: https://pypi.org/project/sphinxtesters/ %if %{with python2} BuildRequires: python-modules >= 1:2.7 @@ -59,18 +60,25 @@ Narzędzia do testowania rozszerzeń Sphinksa. %prep %setup -q -n sphinxtesters-%{version} +%patch0 -p1 %build %if %{with python2} %py_build -%{?with_tests:%{__python} -m pytest sphinxtesters/tests} +%if %{with tests} +PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ +%{__python} -m pytest sphinxtesters/tests +%endif %endif %if %{with python3} %py3_build -%{?with_tests:%{__python3} -m pytest sphinxtesters/tests} +%if %{with tests} +PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ +%{__python3} -m pytest sphinxtesters/tests +%endif %endif %install -- 2.44.0