From dd944e17b2436cdb2d6ee6f9c9ba5dc2948bc6e14d3820ad48921685cd1fd2eb Mon Sep 17 00:00:00 2001 From: Benjamin Greiner Date: Fri, 17 Dec 2021 18:16:07 +0000 Subject: [PATCH] Accepting request 941282 from home:bnavigator:python-rpm-macros - Add poetry-3544-py310.patch for compatibility with Python 3.10 gh#python-poetry/poetry#3544 OBS-URL: https://build.opensuse.org/request/show/941282 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-poetry?expand=0&rev=39 --- poetry-3544-py310.patch | 61 +++++++++++++++++++++++++++++++++++++++++ python-poetry.changes | 6 ++++ python-poetry.spec | 4 ++- 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 poetry-3544-py310.patch diff --git a/poetry-3544-py310.patch b/poetry-3544-py310.patch new file mode 100644 index 0000000..1f02942 --- /dev/null +++ b/poetry-3544-py310.patch @@ -0,0 +1,61 @@ +From a72ebc3afb3301383497159abb8327aeec59494f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Wed, 6 Jan 2021 13:15:18 +0100 +Subject: [PATCH] Fix a typo in autospec + +On Python 3.10, I get: + + =================================== FAILURES =================================== + _____________________ test_info_setup_complex_pep517_error _____________________ + + mocker = + demo_setup_complex = PosixPath('/tmp/pytest-of-mockbuild/pytest-0/test_info_setup_complex_pep5170') + + def test_info_setup_complex_pep517_error(mocker, demo_setup_complex): + > mocker.patch( + "poetry.utils.env.VirtualEnv.run", + auto_spec=True, + side_effect=EnvCommandError(CalledProcessError(1, "mock", output="mock")), + ) + + tests/inspection/test_info.py:191: + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + /usr/lib/python3.10/site-packages/pytest_mock/plugin.py:376: in __call__ + return self._start_patch( + /usr/lib/python3.10/site-packages/pytest_mock/plugin.py:184: in _start_patch + p = mock_func(*args, **kwargs) + /usr/lib64/python3.10/unittest/mock.py:1736: in patch + return _patch( + /usr/lib64/python3.10/unittest/mock.py:1275: in __init__ + _check_spec_arg_typos(kwargs) + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + + kwargs_to_check = {'auto_spec': True, 'side_effect': EnvCommandError('Command mock errored with the following return code 1, and output: \nmock')} + + def _check_spec_arg_typos(kwargs_to_check): + typos = ("autospect", "auto_spec", "set_spec") + for typo in typos: + if typo in kwargs_to_check: + > raise RuntimeError( + f"{typo!r} might be a typo; use unsafe=True if this is intended" + ) + E RuntimeError: 'auto_spec' might be a typo; use unsafe=True if this is intended + + /usr/lib64/python3.10/unittest/mock.py:1251: RuntimeError +--- + tests/inspection/test_info.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/inspection/test_info.py b/tests/inspection/test_info.py +index e04bd52a5..ac0c4504e 100644 +--- a/tests/inspection/test_info.py ++++ b/tests/inspection/test_info.py +@@ -174,7 +174,7 @@ def test_info_setup_complex(demo_setup_complex): + def test_info_setup_complex_pep517_error(mocker, demo_setup_complex): + mocker.patch( + "poetry.utils.env.VirtualEnv.run", +- auto_spec=True, ++ autospec=True, + side_effect=EnvCommandError(CalledProcessError(1, "mock", output="mock")), + ) + diff --git a/python-poetry.changes b/python-poetry.changes index 43e2df1..818ff02 100644 --- a/python-poetry.changes +++ b/python-poetry.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Dec 17 18:14:36 UTC 2021 - Ben Greiner + +- Add poetry-3544-py310.patch for compatibility with Python 3.10 + gh#python-poetry/poetry#3544 + ------------------------------------------------------------------- Sat Dec 4 21:01:43 UTC 2021 - Ben Greiner diff --git a/python-poetry.spec b/python-poetry.spec index 6b04a89..c22b805 100644 --- a/python-poetry.spec +++ b/python-poetry.spec @@ -33,6 +33,8 @@ Patch0: poetry-1645-1.1.patch Patch1: use-new-name-of-MockFixture.patch # PATCH-FIX-UPSTREAM https://github.com/python-poetry/poetry/pull/4749 -- make compatible with packaging >= 21 Patch2: poetry-4749-1.1.patch +# PATCH-FIX-UPSTREAM poetry-3544-py310.patch -- gh#python-poetry/poetry#3544 -- python310 fixes +Patch3: https://github.com/python-poetry/poetry/pull/3544.patch#/poetry-3544-py310.patch BuildRequires: %{python_module CacheControl >= 0.12.9} BuildRequires: %{python_module cachy >= 0.3.0} BuildRequires: %{python_module cleo >= 0.8.1} @@ -61,9 +63,9 @@ Requires: python-html5lib >= 1.0 Requires: python-keyring >= 21.2.0 # cachecontrol[filecache] Requires: python-lockfile >= 0.9 -Requires: python-pkginfo >= 1.5 Requires: python-packaging >= 20.4 Requires: python-pexpect >= 4.7.0 +Requires: python-pkginfo >= 1.5 Requires: python-poetry-core >= 1.0.7 Requires: python-requests >= 2.18 Requires: python-requests-toolbelt >= 0.9.1