Accepting request 960476 from home:pgajdos:python

- do not require mock for build
- added patches
  b5c6812b40
  + python-catkin-pkg-no-mock.patch

OBS-URL: https://build.opensuse.org/request/show/960476
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-catkin-pkg?expand=0&rev=14
This commit is contained in:
Matej Cepl 2022-03-10 10:39:20 +00:00 committed by Git OBS Bridge
parent fa860efde7
commit 471d59678d
3 changed files with 86 additions and 2 deletions

View File

@ -0,0 +1,74 @@
diff --git a/test/test_package.py b/test/test_package.py
index 98420c5..1a417b0 100644
--- a/test/test_package.py
+++ b/test/test_package.py
@@ -20,7 +20,10 @@
Person,
)
-from mock import Mock
+try:
+ from unittest.mock import Mock
+except ImportError:
+ from mock import Mock
sys.stderr = sys.stdout
diff --git a/test/test_package_version.py b/test/test_package_version.py
index 6265347..190802b 100644
--- a/test/test_package_version.py
+++ b/test/test_package_version.py
@@ -9,7 +9,10 @@
from catkin_pkg.package_version import update_changelog_sections
from catkin_pkg.package_version import update_versions
-import mock
+try:
+ from unittest.mock import Mock
+except ImportError:
+ from mock import Mock
from .util import in_temporary_directory
@@ -69,7 +72,7 @@ def test_update_changelog_unicode(self, directory=None):
temp_file = os.path.join(directory, 'changelog')
missing_changelogs_but_forthcoming = {}
# Mock the Changelog object from catkin_pkg
- mock_changelog = mock.Mock()
+ mock_changelog = Mock()
# Create a changelog entry with a unicode char.
mock_changelog.rst = ('^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n'
'Changelog for package fake_pkg\n'
diff --git a/test/test_templates.py b/test/test_templates.py
index 561ec28..164f1b1 100644
--- a/test/test_templates.py
+++ b/test/test_templates.py
@@ -8,7 +8,10 @@
create_cmakelists, create_package_files, create_package_xml, PackageTemplate
from catkin_pkg.python_setup import generate_distutils_setup
-from mock import MagicMock, Mock
+try:
+ from unittest.mock import MagicMock, Mock
+except ImportError:
+ from mock import MagicMock, Mock
def u(line):
diff --git a/test/test_topological_order.py b/test/test_topological_order.py
index 651cb6b..88f44b4 100644
--- a/test/test_topological_order.py
+++ b/test/test_topological_order.py
@@ -3,7 +3,10 @@
import sys
import unittest
-from mock import Mock
+try:
+ from mock import Mock
+except ImportError:
+ from unittest.mock import Mock
try:
from catkin_pkg.topological_order import topological_order_packages, _PackageDecorator, \

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Mar 9 11:43:28 UTC 2022 - pgajdos@suse.com
- do not require mock for build
- added patches
https://github.com/ros-infrastructure/catkin_pkg/commit/b5c6812b40fa31da91ee560dda7c6e470dedcfb8
+ python-catkin-pkg-no-mock.patch
-------------------------------------------------------------------
Sat Jan 15 18:34:37 UTC 2022 - Dirk Müller <dmueller@suse.com>

View File

@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define commands create_pkg find_pkg generate_changelog package_version prepare_release tag_changelog test_changelog
%define skip_python2 1
Name: python-catkin-pkg
Version: 0.4.24
Release: 0
@ -26,6 +26,8 @@ Summary: Catkin package library
License: BSD-3-Clause
URL: https://wiki.ros.org/catkin_pkg
Source: https://github.com/ros-infrastructure/catkin_pkg/archive/%{version}.tar.gz
# https://github.com/ros-infrastructure/catkin_pkg/commit/b5c6812b40fa31da91ee560dda7c6e470dedcfb8.diff
Patch0: python-catkin-pkg-no-mock.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@ -39,7 +41,6 @@ BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module docutils}
BuildRequires: %{python_module flake8}
BuildRequires: %{python_module mock}
BuildRequires: %{python_module pyparsing}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module python-dateutil}
@ -51,6 +52,7 @@ Library for retrieving information about catkin packages.
%prep
%setup -q -n catkin_pkg-%{version}
%autopatch -p1
%build
%python_build