1
0

- Readd fixed

python-sphinx-autodoc-typehints-system-object.inv.patch which
  makes tests requiring network working

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-sphinx-autodoc-typehints?expand=0&rev=19
This commit is contained in:
Matej Cepl 2021-04-23 16:21:14 +00:00 committed by Git OBS Bridge
parent 96d010c0f2
commit 8b8a7243f8
4 changed files with 38 additions and 40 deletions

View File

@ -1,36 +0,0 @@
---
setup.cfg | 2 ++
tests/test_sphinx_autodoc_typehints.py | 4 ++++
2 files changed, 6 insertions(+)
--- a/setup.cfg
+++ b/setup.cfg
@@ -43,6 +43,8 @@ max-line-length = 99
[tool:pytest]
addopts = -rsx --tb=short
testpaths = tests
+markers =
+ network: marks tests which require network connection
[egg_info]
tag_build =
--- a/tests/test_sphinx_autodoc_typehints.py
+++ b/tests/test_sphinx_autodoc_typehints.py
@@ -95,6 +95,8 @@ def test_parse_annotation(annotation, mo
assert get_annotation_args(annotation, module, class_name) == args
+# requires inv fixtures which doesn't work without network connection
+@pytest.mark.network
@pytest.mark.parametrize('annotation, expected_result', [
(str, ':py:class:`str`'),
(int, ':py:class:`int`'),
@@ -177,6 +179,8 @@ def test_format_annotation(inv, annotati
assert m.group('role') == expected_role
+# requires inv fixtures which doesn't work without network connection
+@pytest.mark.network
@pytest.mark.parametrize('library', [typing, typing_extensions],
ids=['typing', 'typing_extensions'])
@pytest.mark.parametrize('annotation, params, expected_result', [

View File

@ -0,0 +1,31 @@
---
tests/conftest.py | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,5 +1,4 @@
import os
-import sys
import pathlib
import shutil
@@ -13,16 +12,8 @@ collect_ignore = ['roots']
@pytest.fixture(scope='session')
def inv(pytestconfig):
- cache_path = 'python{v.major}.{v.minor}/objects.inv'.format(v=sys.version_info)
- inv_dict = pytestconfig.cache.get(cache_path, None)
- if inv_dict is not None:
- return Inventory(inv_dict)
-
- print("Downloading objects.inv")
- url = 'https://docs.python.org/{v.major}.{v.minor}/objects.inv'.format(v=sys.version_info)
- inv = Inventory(url=url)
- pytestconfig.cache.set(cache_path, inv.json_dict())
- return inv
+ inv_dict = '/usr/share/doc/packages/python@PYTHON_VERSION@/html/objects.inv'
+ return Inventory(inv_dict)
@pytest.fixture(autouse=True)

View File

@ -1,7 +1,9 @@
-------------------------------------------------------------------
Fri Apr 23 14:24:23 UTC 2021 - Matej Cepl <mcepl@suse.com>
- Add no-net-tests.patch which marks tests requiring network
- Readd fixed
python-sphinx-autodoc-typehints-system-object.inv.patch which
makes tests requiring network working
(gh#agronholm/sphinx-autodoc-typehints#174).
-------------------------------------------------------------------

View File

@ -26,9 +26,9 @@ License: MIT
Group: Development/Languages/Python
URL: https://github.com/agronholm/sphinx-autodoc-typehints
Source: https://files.pythonhosted.org/packages/source/s/sphinx-autodoc-typehints/sphinx-autodoc-typehints-%{version}.tar.gz
# PATCH-FIX-UPSTREAM no-net-tests.patch gh#agronholm/sphinx-autodoc-typehints#174 mcepl@suse.com
# PATCH-FIX-UPSTREAM python-sphinx-autodoc-typehints-system-object.inv.patch gh#agronholm/sphinx-autodoc-typehints#174 mcepl@suse.com
# skip network tests
Patch0: no-net-tests.patch
Patch0: python-sphinx-autodoc-typehints-system-object.inv.patch
BuildRequires: %{python_module setuptools >= 36.2.7}
BuildRequires: %{python_module setuptools_scm >= 1.7.0}
BuildRequires: fdupes
@ -55,6 +55,7 @@ and return value types of functions.
%build
%python_build
%python_expand sed -i -e 's/@PYTHON_VERSION@/%{$python_version}/' tests/conftest.py
%install
%python_install
@ -62,7 +63,7 @@ and return value types of functions.
%check
# test_sphinx_output -- too depenedent on sphinx version available
%pytest -k 'not (test_sphinx_output or network)'
%pytest -k 'not test_sphinx_output'
%files %{python_files}
%{python_sitelib}/*