15
0

- Switch to autosetup and pyproject macros.

- Add Requires for update-alternatives.
- Add patch correct-test-assertion-methods.patch:
  * Use non-removed test assertion methods.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-dbus-deviation?expand=0&rev=13
This commit is contained in:
2024-01-22 02:03:49 +00:00
committed by Git OBS Bridge
parent 70e479e566
commit ad097d0ff6
3 changed files with 103 additions and 8 deletions

View File

@@ -0,0 +1,83 @@
From 2ee6b32cc893eeda74a67593efc80f603b74a73c Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
Date: Mon, 22 Jan 2024 12:41:49 +1100
Subject: [PATCH] Use self.assertEqual() everywhere
self.assertEquals() has been deprecated since 3.1 and was finally
removed in Python 3.12. Move with the times and use the correct method
name.
---
dbusapi/tests/test_ast.py | 6 +++---
dbusapi/tests/test_interfaceparser.py | 18 +++++++++---------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/dbusapi/tests/test_ast.py b/dbusapi/tests/test_ast.py
index 70979ea..462bb90 100755
--- a/dbusapi/tests/test_ast.py
+++ b/dbusapi/tests/test_ast.py
@@ -227,9 +227,9 @@ def test_walk(self):
})
children = [node for node in iface.walk()]
- self.assertEquals(len(children), 2)
- self.assertEquals(children[0], method)
- self.assertEquals(children[1], annotation)
+ self.assertEqual(len(children), 2)
+ self.assertEqual(children[0], method)
+ self.assertEqual(children[1], annotation)
class TestAstSignatures(unittest.TestCase):
diff --git a/dbusapi/tests/test_interfaceparser.py b/dbusapi/tests/test_interfaceparser.py
index 1902534..09d54ec 100755
--- a/dbusapi/tests/test_interfaceparser.py
+++ b/dbusapi/tests/test_interfaceparser.py
@@ -459,13 +459,13 @@ def test_doc_comments(self):
(parser, interfaces, _) = _test_parser(xml)
interface = interfaces.get('I.I')
self.assertIsNotNone(interface)
- self.assertEquals(interface.comment, "Please consider me")
+ self.assertEqual(interface.comment, "Please consider me")
meth = interface.methods.get('foo')
self.assertIsNotNone(meth)
- self.assertEquals(meth.comment, "Notice me too")
- self.assertEquals(len(meth.arguments), 1)
+ self.assertEqual(meth.comment, "Notice me too")
+ self.assertEqual(len(meth.arguments), 1)
arg = meth.arguments[0]
- self.assertEquals(arg.comment, "And me!")
+ self.assertEqual(arg.comment, "And me!")
def test_line_numbers(self):
"""Test that line numbers are correctly computed"""
@@ -498,7 +498,7 @@ def test_line_numbers(self):
self.assertIsNotNone(meth)
self.assertEqual(meth.line_number, 9)
self.assertEqual(meth.comment_line_number, 6)
- self.assertEquals(len(meth.arguments), 2)
+ self.assertEqual(len(meth.arguments), 2)
arg = meth.arguments[0]
self.assertEqual(arg.line_number, 13)
self.assertEqual(arg.comment_line_number, 10)
@@ -517,7 +517,7 @@ def test_doc_annotations(self):
(parser, interfaces, _) = _test_parser(xml)
interface = interfaces.get('I.I')
self.assertIsNotNone(interface)
- self.assertEquals(interface.comment, "bla")
+ self.assertEqual(interface.comment, "bla")
def test_multiline_comments(self):
xml = ("<node xmlns:tp='"
@@ -534,9 +534,9 @@ def test_multiline_comments(self):
(parser, interfaces, _) = _test_parser(xml)
interface = interfaces.get('I.I')
self.assertIsNotNone(interface)
- self.assertEquals(interface.comment,
- " Please consider that\n"
- " multiline comment")
+ self.assertEqual(interface.comment,
+ " Please consider that\n"
+ " multiline comment")
def test_ignored_comments(self):
xml = ("<node xmlns:tp='"

View File

@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Mon Jan 22 02:03:06 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Switch to autosetup and pyproject macros.
- Add Requires for update-alternatives.
- Add patch correct-test-assertion-methods.patch:
* Use non-removed test assertion methods.
-------------------------------------------------------------------
Mon May 17 08:30:46 UTC 2021 - Steve Kowalik <steven.kowalik@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-dbus-deviation
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,17 +16,19 @@
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-dbus-deviation
Version: 0.6.1
Release: 0
Summary: Parse D-Bus introspection XML and process it in various ways
License: LGPL-2.1-or-later
URL: http://people.collabora.com/~pwith/dbus-deviation/
URL: https://tecnocode.co.uk/dbus-deviation/
Source: https://files.pythonhosted.org/packages/source/d/dbus-deviation/dbus-deviation-%{version}.tar.gz
# PATCH-FIX-UPSTREAM gh#pwithnall/dbus-deviation#21
Patch0: correct-test-assertion-methods.patch
BuildRequires: %{python_module Sphinx}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-lxml
@@ -34,6 +36,8 @@ BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module lxml}
# /SECTION
Requires(post): update-alternatives
Requires(postun):update-alternatives
%python_subpackages
%description
@@ -43,16 +47,16 @@ difference between two D-Bus APIs for the purpose of checking for API breaks.
This functionality is also available as a Python module, dbusdeviation.
%prep
%setup -q -n dbus-deviation-%{version}
%autosetup -p1 -n dbus-deviation-%{version}
sed -i -e "/setuptools_/d" setup.py
chmod -x dbusapi/tests/*.py dbusdeviation/tests/*.py dbusdeviation/utilities/*.py
sed -i '1 {/^#!/d}' dbusapi/tests/*.py dbusdeviation/tests/*.py dbusdeviation/utilities/*.py
%build
%python_build
%pyproject_wheel
%install
%python_install
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/dbus-interface-diff
%python_clone -a %{buildroot}%{_bindir}/dbus-interface-vcs-helper
%python_expand %fdupes %{buildroot}%{$python_sitelib}
@@ -73,6 +77,6 @@ sed -i '1 {/^#!/d}' dbusapi/tests/*.py dbusdeviation/tests/*.py dbusdeviation/ut
%python_alternative %{_bindir}/dbus-interface-vcs-helper
%{python_sitelib}/dbusapi
%{python_sitelib}/dbusdeviation
%{python_sitelib}/dbus_deviation-%{version}*-info
%{python_sitelib}/dbus_deviation-%{version}.dist-info
%changelog