From 46262b3a0616c4cfcefbc88228008a4c36e45ab0 Mon Sep 17 00:00:00 2001 From: DistroBaker Date: Thu, 11 Mar 2021 20:19:58 +0000 Subject: [PATCH] Merged update from upstream sources This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/python-dbusmock.git#733704339cc61ae2b0519135f120eca1d5cfd3a6 --- .gitignore | 1 + ...d-mock-server-for-low-memory-monitor.patch | 130 ------------------ python-dbusmock.spec | 18 ++- sources | 2 +- 4 files changed, 13 insertions(+), 138 deletions(-) delete mode 100644 0001-Add-mock-server-for-low-memory-monitor.patch diff --git a/.gitignore b/.gitignore index a134119..eb381bc 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ /python-dbusmock-0.16.9.tar.gz /python-dbusmock-0.17.tar.gz /python-dbusmock-0.18.3.tar.gz +/python-dbusmock-0.22.0.tar.gz diff --git a/0001-Add-mock-server-for-low-memory-monitor.patch b/0001-Add-mock-server-for-low-memory-monitor.patch deleted file mode 100644 index 9a75423..0000000 --- a/0001-Add-mock-server-for-low-memory-monitor.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 157499e2f07e6cf77e6ddd1619a55932809f99cb Mon Sep 17 00:00:00 2001 -From: Bastien Nocera -Date: Thu, 14 Nov 2019 14:09:44 +0100 -Subject: [PATCH] Add mock server for low-memory-monitor - -API version 2.0 - -https://gitlab.freedesktop.org/hadess/low-memory-monitor/ ---- - dbusmock/templates/low_memory_monitor.py | 38 +++++++++++++++ - tests/test_low_memory_monitor.py | 62 ++++++++++++++++++++++++ - 2 files changed, 100 insertions(+) - create mode 100644 dbusmock/templates/low_memory_monitor.py - create mode 100644 tests/test_low_memory_monitor.py - -diff --git a/dbusmock/templates/low_memory_monitor.py b/dbusmock/templates/low_memory_monitor.py -new file mode 100644 -index 0000000..bb9a757 ---- /dev/null -+++ b/dbusmock/templates/low_memory_monitor.py -@@ -0,0 +1,38 @@ -+'''low-memory-monitor mock template -+ -+This creates the expected methods and properties of the main -+org.freedesktop.LowMemoryMonitor object. -+ -+This provides only the 2.0 D-Bus API of low-memory-monitor. -+''' -+ -+# This program is free software; you can redistribute it and/or modify it under -+# the terms of the GNU Lesser General Public License as published by the Free -+# Software Foundation; either version 3 of the License, or (at your option) any -+# later version. See http://www.gnu.org/copyleft/lgpl.html for the full text -+# of the license. -+ -+__author__ = 'Bastien Nocera' -+__email__ = 'hadess@hadess.net' -+__copyright__ = '(c) 2019, Red Hat Inc.' -+__license__ = 'LGPL 3+' -+ -+import dbus -+ -+from dbusmock import MOCK_IFACE, mockobject -+import dbusmock -+ -+BUS_NAME = 'org.freedesktop.LowMemoryMonitor' -+MAIN_OBJ = '/org/freedesktop/LowMemoryMonitor' -+MAIN_IFACE = 'org.freedesktop.LowMemoryMonitor' -+SYSTEM_BUS = True -+ -+ -+def load(mock, parameters): -+ # Loaded! -+ mock.loaded = True -+ -+@dbus.service.method(MOCK_IFACE, -+ in_signature='y', out_signature='') -+def EmitWarning(self, state): -+ self.EmitSignal(MAIN_IFACE, 'LowMemoryWarning', 'y', [dbus.Byte(state)]) -diff --git a/tests/test_low_memory_monitor.py b/tests/test_low_memory_monitor.py -new file mode 100644 -index 0000000..b4b1fd7 ---- /dev/null -+++ b/tests/test_low_memory_monitor.py -@@ -0,0 +1,62 @@ -+#!/usr/bin/python3 -+ -+# This program is free software; you can redistribute it and/or modify it under -+# the terms of the GNU Lesser General Public License as published by the Free -+# Software Foundation; either version 3 of the License, or (at your option) any -+# later version. See http://www.gnu.org/copyleft/lgpl.html for the full text -+# of the license. -+ -+__author__ = 'Bastien Nocera' -+__email__ = 'hadess@hadess.net' -+__copyright__ = '(c) 2019 Red Hat Inc.' -+__license__ = 'LGPL 3+' -+ -+import unittest -+import sys -+import subprocess -+import dbus -+import dbus.mainloop.glib -+import dbusmock -+import fcntl -+import os -+ -+from gi.repository import GLib -+ -+dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) -+ -+class TestLowMemoryMonitor(dbusmock.DBusTestCase): -+ '''Test mocking gnome-screensaver''' -+ -+ @classmethod -+ def setUpClass(klass): -+ klass.start_system_bus() -+ klass.dbus_con = klass.get_dbus(True) -+ -+ def setUp(self): -+ (self.p_mock, self.obj_lmm) = self.spawn_server_template( -+ 'low_memory_monitor', {}, stdout=subprocess.PIPE) -+ # set log to nonblocking -+ flags = fcntl.fcntl(self.p_mock.stdout, fcntl.F_GETFL) -+ fcntl.fcntl(self.p_mock.stdout, fcntl.F_SETFL, flags | os.O_NONBLOCK) -+ self.last_warning = -1 -+ self.dbusmock = dbus.Interface(self.obj_lmm, dbusmock.MOCK_IFACE) -+ -+ def tearDown(self): -+ self.p_mock.terminate() -+ self.p_mock.wait() -+ -+ def test_low_memory_warning_signal(self): -+ '''LowMemoryWarning signal''' -+ -+ self.dbusmock.EmitWarning(100) -+ log = self.p_mock.stdout.read() -+ self.assertRegex(log, b'[0-9.]+ emit .*LowMemoryWarning 100\n') -+ -+ self.dbusmock.EmitWarning(255) -+ log = self.p_mock.stdout.read() -+ self.assertRegex(log, b'[0-9.]+ emit .*LowMemoryWarning 255\n') -+ -+ -+if __name__ == '__main__': -+ # avoid writing to stderr -+ unittest.main(testRunner=unittest.TextTestRunner(stream=sys.stdout, verbosity=2)) --- -2.21.0 - diff --git a/python-dbusmock.spec b/python-dbusmock.spec index aeafb8c..d8e8ef2 100644 --- a/python-dbusmock.spec +++ b/python-dbusmock.spec @@ -1,22 +1,19 @@ %global modname dbusmock Name: python-%{modname} -Version: 0.18.3 -Release: 6%{?dist} +Version: 0.22.0 +Release: 2%{?dist} Summary: Mock D-Bus objects License: LGPLv3+ URL: https://pypi.python.org/pypi/python-dbusmock Source0: https://files.pythonhosted.org/packages/source/p/%{name}/%{name}-%{version}.tar.gz -# From https://github.com/martinpitt/python-dbusmock/pull/54 -Patch0: 0001-Add-mock-server-for-low-memory-monitor.patch BuildArch: noarch BuildRequires: git BuildRequires: python3-dbus BuildRequires: python3-devel BuildRequires: python3-setuptools -BuildRequires: python3-nose BuildRequires: python3-gobject BuildRequires: dbus-x11 BuildRequires: upower @@ -47,14 +44,21 @@ rm -rf python-%{modname}.egg-info %py3_install %check -# Tests are disabled for now -%{__python3} setup.py test +%{__python3} -m unittest -v %files -n python3-dbusmock %doc README.rst COPYING %{python3_sitelib}/*%{modname}* %changelog +* Mon Mar 01 2021 Charalampos Stratakis - 0.22.0-2 +- Remove redundant dependency on python3-nose + +* Fri Feb 12 2021 Bastien Nocera - 0.22.0-1 ++ python-dbusmock-0.22.0-1 +- Update to 0.22.0 +- Disable tests + * Wed Jan 27 2021 Fedora Release Engineering - 0.18.3-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild diff --git a/sources b/sources index 467327a..6b98c3b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (python-dbusmock-0.18.3.tar.gz) = 6f7b42eae578ce03024b3b5cc85e82f04a467803f4c8b4cb5193454dcd849038f11e6ce5028ca9dd57ea5a9380c1b754d8fc644b4a24b51deee9e87b409115c3 +SHA512 (python-dbusmock-0.22.0.tar.gz) = 2c3430f4178a16acc376ce582f4a1a9bbe8b917efcd7eee58dab85ee3addf60ba355ae9e7b318ec2cdf7ca771183c37d16520a1e5bcab8414c66e2d2a36d26fe