forked from pool/python-jenkinsapi
Accepting request 974537 from home:pgajdos:python
- do not require python-mock for build - added patches fix https://github.com/pycontribs/jenkinsapi/issues/819 + python-jenkinsapi-no-mock.patch OBS-URL: https://build.opensuse.org/request/show/974537 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-jenkinsapi?expand=0&rev=19
This commit is contained in:
parent
4317e0e208
commit
5d1490374a
163
python-jenkinsapi-no-mock.patch
Normal file
163
python-jenkinsapi-no-mock.patch
Normal file
@ -0,0 +1,163 @@
|
||||
diff -upr jenkinsapi-0.3.11.orig/jenkinsapi_tests/unittests/test_artifact.py jenkinsapi-0.3.11/jenkinsapi_tests/unittests/test_artifact.py
|
||||
--- jenkinsapi-0.3.11.orig/jenkinsapi_tests/unittests/test_artifact.py 2022-05-03 09:35:57.849050984 +0200
|
||||
+++ jenkinsapi-0.3.11/jenkinsapi_tests/unittests/test_artifact.py 2022-05-03 09:36:46.685349578 +0200
|
||||
@@ -1,5 +1,5 @@
|
||||
import pytest
|
||||
-from mock import (
|
||||
+from unittest.mock import (
|
||||
Mock,
|
||||
patch,
|
||||
call
|
||||
diff -upr jenkinsapi-0.3.11.orig/jenkinsapi_tests/unittests/test_executors.py jenkinsapi-0.3.11/jenkinsapi_tests/unittests/test_executors.py
|
||||
--- jenkinsapi-0.3.11.orig/jenkinsapi_tests/unittests/test_executors.py 2022-05-03 09:35:57.849050984 +0200
|
||||
+++ jenkinsapi-0.3.11/jenkinsapi_tests/unittests/test_executors.py 2022-05-03 09:36:46.685349578 +0200
|
||||
@@ -1,5 +1,5 @@
|
||||
import pytest
|
||||
-import mock
|
||||
+from unittest import mock
|
||||
from jenkinsapi.jenkins import Jenkins
|
||||
from jenkinsapi.executors import Executors
|
||||
from jenkinsapi.executor import Executor
|
||||
diff -upr jenkinsapi-0.3.11.orig/jenkinsapi_tests/unittests/test_job_folders.py jenkinsapi-0.3.11/jenkinsapi_tests/unittests/test_job_folders.py
|
||||
--- jenkinsapi-0.3.11.orig/jenkinsapi_tests/unittests/test_job_folders.py 2022-05-03 09:35:57.853051009 +0200
|
||||
+++ jenkinsapi-0.3.11/jenkinsapi_tests/unittests/test_job_folders.py 2022-05-03 09:36:46.685349578 +0200
|
||||
@@ -1,5 +1,5 @@
|
||||
import pytest
|
||||
-import mock
|
||||
+from unittest import mock
|
||||
from jenkinsapi.jenkins import JenkinsBase
|
||||
|
||||
|
||||
diff -upr jenkinsapi-0.3.11.orig/jenkinsapi_tests/unittests/test_job_get_all_builds.py jenkinsapi-0.3.11/jenkinsapi_tests/unittests/test_job_get_all_builds.py
|
||||
--- jenkinsapi-0.3.11.orig/jenkinsapi_tests/unittests/test_job_get_all_builds.py 2022-05-03 09:35:57.853051009 +0200
|
||||
+++ jenkinsapi-0.3.11/jenkinsapi_tests/unittests/test_job_get_all_builds.py 2022-05-03 09:36:46.685349578 +0200
|
||||
@@ -1,4 +1,4 @@
|
||||
-import mock
|
||||
+from unittest import mock
|
||||
# To run unittests on python 2.6 please use unittest2 library
|
||||
try:
|
||||
import unittest2 as unittest
|
||||
diff -upr jenkinsapi-0.3.11.orig/jenkinsapi_tests/unittests/test_job.py jenkinsapi-0.3.11/jenkinsapi_tests/unittests/test_job.py
|
||||
--- jenkinsapi-0.3.11.orig/jenkinsapi_tests/unittests/test_job.py 2022-05-03 09:35:57.853051009 +0200
|
||||
+++ jenkinsapi-0.3.11/jenkinsapi_tests/unittests/test_job.py 2022-05-03 09:36:46.685349578 +0200
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import pytest
|
||||
-import mock
|
||||
+from unittest import mock
|
||||
import json
|
||||
from . import configs
|
||||
from jenkinsapi.job import Job
|
||||
diff -upr jenkinsapi-0.3.11.orig/jenkinsapi_tests/unittests/test_job_scm_hg.py jenkinsapi-0.3.11/jenkinsapi_tests/unittests/test_job_scm_hg.py
|
||||
--- jenkinsapi-0.3.11.orig/jenkinsapi_tests/unittests/test_job_scm_hg.py 2022-05-03 09:35:57.853051009 +0200
|
||||
+++ jenkinsapi-0.3.11/jenkinsapi_tests/unittests/test_job_scm_hg.py 2022-05-03 09:36:46.689349602 +0200
|
||||
@@ -1,4 +1,4 @@
|
||||
-import mock
|
||||
+from unittest import mock
|
||||
# To run unittests on python 2.6 please use unittest2 library
|
||||
try:
|
||||
import unittest2 as unittest
|
||||
diff -upr jenkinsapi-0.3.11.orig/jenkinsapi_tests/unittests/test_plugins.py jenkinsapi-0.3.11/jenkinsapi_tests/unittests/test_plugins.py
|
||||
--- jenkinsapi-0.3.11.orig/jenkinsapi_tests/unittests/test_plugins.py 2022-05-03 09:35:57.853051009 +0200
|
||||
+++ jenkinsapi-0.3.11/jenkinsapi_tests/unittests/test_plugins.py 2022-05-03 09:36:46.689349602 +0200
|
||||
@@ -1,7 +1,7 @@
|
||||
"""
|
||||
jenkinsapi_tests.test_plugins
|
||||
"""
|
||||
-import mock
|
||||
+from unittest import mock
|
||||
|
||||
# To run unittests on python 2.6 please use unittest2 library
|
||||
try:
|
||||
@@ -215,7 +215,7 @@ class TestPlugins(unittest.TestCase):
|
||||
@mock.patch.object(Plugins, '_poll')
|
||||
@mock.patch.object(Plugins, 'plugin_version_already_installed')
|
||||
@mock.patch.object(Plugins, 'restart_required',
|
||||
- new_callable=mock.mock.PropertyMock)
|
||||
+ new_callable=unittest.mock.PropertyMock)
|
||||
@mock.patch.object(Plugins, '_wait_until_plugin_installed')
|
||||
@mock.patch.object(Requester, 'post_xml_and_confirm_status')
|
||||
@mock.patch.object(Jenkins, 'safe_restart')
|
||||
@@ -234,7 +234,7 @@ class TestPlugins(unittest.TestCase):
|
||||
@mock.patch.object(Plugins, '_poll')
|
||||
@mock.patch.object(Plugins, 'plugin_version_already_installed')
|
||||
@mock.patch.object(Plugins, 'restart_required',
|
||||
- new_callable=mock.mock.PropertyMock)
|
||||
+ new_callable=unittest.mock.PropertyMock)
|
||||
@mock.patch.object(Plugins, '_wait_until_plugin_installed')
|
||||
@mock.patch.object(Requester, 'post_xml_and_confirm_status')
|
||||
@mock.patch.object(Jenkins, 'safe_restart')
|
||||
@@ -284,7 +284,7 @@ class TestPlugins(unittest.TestCase):
|
||||
|
||||
@mock.patch.object(Plugins, '_poll')
|
||||
@mock.patch.object(Plugins, 'update_center_install_status',
|
||||
- new_callable=mock.mock.PropertyMock)
|
||||
+ new_callable=unittest.mock.PropertyMock)
|
||||
def test_restart_required_after_plugin_installation(self, status,
|
||||
_poll_plugins):
|
||||
_poll_plugins.return_value = self.DATA
|
||||
@@ -305,7 +305,7 @@ class TestPlugins(unittest.TestCase):
|
||||
|
||||
@mock.patch.object(Plugins, '_poll')
|
||||
@mock.patch.object(Plugins, 'update_center_install_status',
|
||||
- new_callable=mock.mock.PropertyMock)
|
||||
+ new_callable=unittest.mock.PropertyMock)
|
||||
def test_restart_not_required_after_plugin_installation(self, status,
|
||||
_poll_plugins):
|
||||
_poll_plugins.return_value = self.DATA
|
||||
diff -upr jenkinsapi-0.3.11.orig/jenkinsapi_tests/unittests/test_requester.py jenkinsapi-0.3.11/jenkinsapi_tests/unittests/test_requester.py
|
||||
--- jenkinsapi-0.3.11.orig/jenkinsapi_tests/unittests/test_requester.py 2022-05-03 09:35:57.853051009 +0200
|
||||
+++ jenkinsapi-0.3.11/jenkinsapi_tests/unittests/test_requester.py 2022-05-03 09:36:46.689349602 +0200
|
||||
@@ -3,7 +3,7 @@ import pytest
|
||||
import requests
|
||||
from jenkinsapi.jenkins import Requester
|
||||
from jenkinsapi.custom_exceptions import JenkinsAPIException
|
||||
-from mock import patch
|
||||
+from unittest.mock import patch
|
||||
|
||||
|
||||
def test_no_parameters_uses_default_values():
|
||||
diff -upr jenkinsapi-0.3.11.orig/jenkinsapi_tests/unittests/test_result_set.py jenkinsapi-0.3.11/jenkinsapi_tests/unittests/test_result_set.py
|
||||
--- jenkinsapi-0.3.11.orig/jenkinsapi_tests/unittests/test_result_set.py 2022-05-03 09:35:57.853051009 +0200
|
||||
+++ jenkinsapi-0.3.11/jenkinsapi_tests/unittests/test_result_set.py 2022-05-03 09:36:46.689349602 +0200
|
||||
@@ -1,4 +1,4 @@
|
||||
-import mock
|
||||
+from unittest import mock
|
||||
# To run unittests on python 2.6 please use unittest2 library
|
||||
try:
|
||||
import unittest2 as unittest
|
||||
@@ -30,7 +30,7 @@ class TestResultSet(unittest.TestCase):
|
||||
'className': 'nose.failure.Failure',
|
||||
'duration': 0.0,
|
||||
'errorDetails': 'No module named mock',
|
||||
- 'errorStackTrace': 'Traceback (most recent call last):\n File "/usr/lib/python2.7/unittest/case.py", line 332, in run\n testMethod()\n File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 390, in loadTestsFromName\n addr.filename, addr.module)\n File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 39, in importFromPath\n return self.importFromDir(dir_path, fqname)\n File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 86, in importFromDir\n mod = load_module(part_fqname, fh, filename, desc)\n File "/var/lib/jenkins/jobs/test_jenkinsapi/workspace/jenkinsapi/src/jenkinsapi_tests/unittests/test_build.py", line 1, in <module>\n import mock\nImportError: No module named mock\n', # noqa
|
||||
+ 'errorStackTrace': 'Traceback (most recent call last):\n File "/usr/lib/python2.7/unittest/case.py", line 332, in run\n testMethod()\n File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 390, in loadTestsFromName\n addr.filename, addr.module)\n File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 39, in importFromPath\n return self.importFromDir(dir_path, fqname)\n File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 86, in importFromDir\n mod = load_module(part_fqname, fh, filename, desc)\n File "/var/lib/jenkins/jobs/test_jenkinsapi/workspace/jenkinsapi/src/jenkinsapi_tests/unittests/test_build.py", line 1, in <module>\n from unittest import mock\nImportError: No module named mock\n', # noqa
|
||||
'failedSince': 88,
|
||||
'name': 'runTest',
|
||||
'skipped': False,
|
||||
diff -upr jenkinsapi-0.3.11.orig/jenkinsapi_tests/unittests/test_view.py jenkinsapi-0.3.11/jenkinsapi_tests/unittests/test_view.py
|
||||
--- jenkinsapi-0.3.11.orig/jenkinsapi_tests/unittests/test_view.py 2022-05-03 09:35:57.849050984 +0200
|
||||
+++ jenkinsapi-0.3.11/jenkinsapi_tests/unittests/test_view.py 2022-05-03 09:36:46.689349602 +0200
|
||||
@@ -1,4 +1,4 @@
|
||||
-import mock
|
||||
+from unittest import mock
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -60,13 +60,13 @@ JOB_DATA = {
|
||||
|
||||
@pytest.fixture
|
||||
def jenkins():
|
||||
- jenkins = mock.MagicMock(auto_spec=True)
|
||||
+ jenkins = mock.MagicMock(autospec=True)
|
||||
jenkins.has_job.return_value = False
|
||||
return jenkins
|
||||
|
||||
|
||||
-@mock.patch.object(Job, '_poll', auto_spec=True)
|
||||
-@mock.patch.object(View, '_poll', auto_spec=True)
|
||||
+@mock.patch.object(Job, '_poll', autospec=True)
|
||||
+@mock.patch.object(View, '_poll', autospec=True)
|
||||
@pytest.fixture
|
||||
def view(_view_poll, _job_poll, jenkins):
|
||||
_view_poll.return_value = DATA
|
@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue May 3 07:40:34 UTC 2022 - pgajdos@suse.com
|
||||
|
||||
- do not require python-mock for build
|
||||
- added patches
|
||||
fix https://github.com/pycontribs/jenkinsapi/issues/819
|
||||
+ python-jenkinsapi-no-mock.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 17 06:51:42 UTC 2020 - pgajdos@suse.com
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-jenkinsapi
|
||||
#
|
||||
# Copyright (c) 2020 SUSE LLC
|
||||
# Copyright (c) 2022 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -25,6 +25,8 @@ License: MIT
|
||||
Group: Development/Languages/Python
|
||||
URL: https://github.com/salimfadhley/jenkinsapi
|
||||
Source: https://files.pythonhosted.org/packages/source/j/jenkinsapi/jenkinsapi-%{version}.tar.gz
|
||||
# https://github.com/pycontribs/jenkinsapi/issues/819
|
||||
Patch0: python-jenkinsapi-no-mock.patch
|
||||
BuildRequires: %{python_module pbr}
|
||||
BuildRequires: %{python_module pytz}
|
||||
BuildRequires: %{python_module requests}
|
||||
@ -37,7 +39,6 @@ Requires: python-six >= 1.10.0
|
||||
BuildArch: noarch
|
||||
# SECTION test requirements
|
||||
BuildRequires: %{python_module astroid >= 1.4.8}
|
||||
BuildRequires: %{python_module mock}
|
||||
BuildRequires: %{python_module pytest-mock}
|
||||
BuildRequires: %{python_module pytest}
|
||||
BuildRequires: %{python_module requests-kerberos}
|
||||
@ -70,6 +71,7 @@ and has
|
||||
|
||||
%prep
|
||||
%setup -q -n jenkinsapi-%{version}
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
%python_build
|
||||
|
Loading…
x
Reference in New Issue
Block a user