Add patch to fix failing tests and FTBFS with Pytest 7.
Resolves: rhbz#2059937
This commit is contained in:
parent
ef889b2ace
commit
a28e0735a1
@ -15,12 +15,13 @@
|
|||||||
Name: ansible-core
|
Name: ansible-core
|
||||||
Summary: A radically simple IT automation system
|
Summary: A radically simple IT automation system
|
||||||
Version: 2.12.3
|
Version: 2.12.3
|
||||||
Release: 1%{?betaver}%{?dist}
|
Release: 2%{?betaver}%{?dist}
|
||||||
|
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
Source0: %pypi_source ansible-core %{version}%{?betaver}
|
Source0: %pypi_source ansible-core %{version}%{?betaver}
|
||||||
|
Patch0: https://github.com/ansible/ansible/pull/76670.patch#/fix-tests-failing-on-pytest-7.patch
|
||||||
|
|
||||||
Url: http://ansible.com
|
Url: https://ansible.com
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
# Require packaging macros if rpm-build exists
|
# Require packaging macros if rpm-build exists
|
||||||
@ -236,6 +237,10 @@ make PYTHON=/usr/bin/python3 tests-py3
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Mar 10 2022 Maxwell G <gotmax@e.email> - 2.12.3-2
|
||||||
|
- Add patch to fix failing tests and FTBFS with Pytest 7.
|
||||||
|
- Resolves: rhbz#2059937
|
||||||
|
|
||||||
* Tue Mar 01 2022 Kevin Fenzi <kevin@scrye.com> - 2.12.3-1
|
* Tue Mar 01 2022 Kevin Fenzi <kevin@scrye.com> - 2.12.3-1
|
||||||
- Update to 2.12.3. Fixes rhbz#2059284
|
- Update to 2.12.3. Fixes rhbz#2059284
|
||||||
|
|
||||||
|
108
fix-tests-failing-on-pytest-7.patch
Normal file
108
fix-tests-failing-on-pytest-7.patch
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
From 52a56f3c0594cf76b3061260711536c23385ee75 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jordan Borean <jborean93@gmail.com>
|
||||||
|
Date: Fri, 7 Jan 2022 09:53:18 +1000
|
||||||
|
Subject: [PATCH 1/2] Fix pytest 7 failures with leaky fixture
|
||||||
|
|
||||||
|
---
|
||||||
|
changelogs/fragments/ansible-test-pytest7.yml | 2 ++
|
||||||
|
test/units/galaxy/test_role_install.py | 17 +++++++++--------
|
||||||
|
2 files changed, 11 insertions(+), 8 deletions(-)
|
||||||
|
create mode 100644 changelogs/fragments/ansible-test-pytest7.yml
|
||||||
|
|
||||||
|
diff --git a/changelogs/fragments/ansible-test-pytest7.yml b/changelogs/fragments/ansible-test-pytest7.yml
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000..305dddb181b4e
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/changelogs/fragments/ansible-test-pytest7.yml
|
||||||
|
@@ -0,0 +1,2 @@
|
||||||
|
+bugfixes:
|
||||||
|
+- ansible-test - Fix tests that were broken with ``pytest 7`` - https://github.com/ansible/ansible/issues/76577
|
||||||
|
diff --git a/test/units/galaxy/test_role_install.py b/test/units/galaxy/test_role_install.py
|
||||||
|
index cf990b55a6d90..687fcac1e53fb 100644
|
||||||
|
--- a/test/units/galaxy/test_role_install.py
|
||||||
|
+++ b/test/units/galaxy/test_role_install.py
|
||||||
|
@@ -8,6 +8,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
import os
|
||||||
|
+import functools
|
||||||
|
import pytest
|
||||||
|
import tempfile
|
||||||
|
|
||||||
|
@@ -59,9 +60,9 @@ def mock_NamedTemporaryFile(mocker, **args):
|
||||||
|
return mock_ntf
|
||||||
|
|
||||||
|
|
||||||
|
-@pytest.fixture(autouse=True)
|
||||||
|
-def init_test(monkeypatch):
|
||||||
|
- monkeypatch.setattr(tempfile, 'NamedTemporaryFile', mock_NamedTemporaryFile)
|
||||||
|
+@pytest.fixture
|
||||||
|
+def init_mock_temp_file(mocker, monkeypatch):
|
||||||
|
+ monkeypatch.setattr(tempfile, 'NamedTemporaryFile', functools.partial(mock_NamedTemporaryFile, mocker))
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
@@ -74,7 +75,7 @@ def mock_role_download_api(mocker, monkeypatch):
|
||||||
|
return mock_role_api
|
||||||
|
|
||||||
|
|
||||||
|
-def test_role_download_github(mocker, galaxy_server, mock_role_download_api, monkeypatch):
|
||||||
|
+def test_role_download_github(init_mock_temp_file, mocker, galaxy_server, mock_role_download_api, monkeypatch):
|
||||||
|
mock_api = mocker.MagicMock()
|
||||||
|
mock_api.side_effect = [
|
||||||
|
StringIO(u'{"available_versions":{"v1":"v1/"}}'),
|
||||||
|
@@ -89,7 +90,7 @@ def test_role_download_github(mocker, galaxy_server, mock_role_download_api, mon
|
||||||
|
assert mock_role_download_api.mock_calls[0][1][0] == 'https://github.com/test_owner/test_role/archive/0.0.1.tar.gz'
|
||||||
|
|
||||||
|
|
||||||
|
-def test_role_download_github_default_version(mocker, galaxy_server, mock_role_download_api, monkeypatch):
|
||||||
|
+def test_role_download_github_default_version(init_mock_temp_file, mocker, galaxy_server, mock_role_download_api, monkeypatch):
|
||||||
|
mock_api = mocker.MagicMock()
|
||||||
|
mock_api.side_effect = [
|
||||||
|
StringIO(u'{"available_versions":{"v1":"v1/"}}'),
|
||||||
|
@@ -104,7 +105,7 @@ def test_role_download_github_default_version(mocker, galaxy_server, mock_role_d
|
||||||
|
assert mock_role_download_api.mock_calls[0][1][0] == 'https://github.com/test_owner/test_role/archive/0.0.2.tar.gz'
|
||||||
|
|
||||||
|
|
||||||
|
-def test_role_download_github_no_download_url_for_version(mocker, galaxy_server, mock_role_download_api, monkeypatch):
|
||||||
|
+def test_role_download_github_no_download_url_for_version(init_mock_temp_file, mocker, galaxy_server, mock_role_download_api, monkeypatch):
|
||||||
|
mock_api = mocker.MagicMock()
|
||||||
|
mock_api.side_effect = [
|
||||||
|
StringIO(u'{"available_versions":{"v1":"v1/"}}'),
|
||||||
|
@@ -119,7 +120,7 @@ def test_role_download_github_no_download_url_for_version(mocker, galaxy_server,
|
||||||
|
assert mock_role_download_api.mock_calls[0][1][0] == 'https://github.com/test_owner/test_role/archive/0.0.1.tar.gz'
|
||||||
|
|
||||||
|
|
||||||
|
-def test_role_download_url(mocker, galaxy_server, mock_role_download_api, monkeypatch):
|
||||||
|
+def test_role_download_url(init_mock_temp_file, mocker, galaxy_server, mock_role_download_api, monkeypatch):
|
||||||
|
mock_api = mocker.MagicMock()
|
||||||
|
mock_api.side_effect = [
|
||||||
|
StringIO(u'{"available_versions":{"v1":"v1/"}}'),
|
||||||
|
@@ -135,7 +136,7 @@ def test_role_download_url(mocker, galaxy_server, mock_role_download_api, monkey
|
||||||
|
assert mock_role_download_api.mock_calls[0][1][0] == 'http://localhost:8080/test_owner/test_role/0.0.1.tar.gz'
|
||||||
|
|
||||||
|
|
||||||
|
-def test_role_download_url_default_version(mocker, galaxy_server, mock_role_download_api, monkeypatch):
|
||||||
|
+def test_role_download_url_default_version(init_mock_temp_file, mocker, galaxy_server, mock_role_download_api, monkeypatch):
|
||||||
|
mock_api = mocker.MagicMock()
|
||||||
|
mock_api.side_effect = [
|
||||||
|
StringIO(u'{"available_versions":{"v1":"v1/"}}'),
|
||||||
|
|
||||||
|
From 47c1f8f5bf3e27103a9320d42b8b1c602b5c27f0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Matt Davis <nitzmahone@users.noreply.github.com>
|
||||||
|
Date: Fri, 7 Jan 2022 15:35:54 -0800
|
||||||
|
Subject: [PATCH 2/2] zap changelog
|
||||||
|
|
||||||
|
---
|
||||||
|
changelogs/fragments/ansible-test-pytest7.yml | 2 --
|
||||||
|
1 file changed, 2 deletions(-)
|
||||||
|
delete mode 100644 changelogs/fragments/ansible-test-pytest7.yml
|
||||||
|
|
||||||
|
diff --git a/changelogs/fragments/ansible-test-pytest7.yml b/changelogs/fragments/ansible-test-pytest7.yml
|
||||||
|
deleted file mode 100644
|
||||||
|
index 305dddb181b4e..0000000000000
|
||||||
|
--- a/changelogs/fragments/ansible-test-pytest7.yml
|
||||||
|
+++ /dev/null
|
||||||
|
@@ -1,2 +0,0 @@
|
||||||
|
-bugfixes:
|
||||||
|
-- ansible-test - Fix tests that were broken with ``pytest 7`` - https://github.com/ansible/ansible/issues/76577
|
Loading…
Reference in New Issue
Block a user