New upstream release. Maintainers, please consider subbing this package to TW proper, we will need it for testing gnome-control-center during build for later versions. See rq#663319 OBS-URL: https://build.opensuse.org/request/show/663324 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-python-dbusmock?expand=0&rev=1
106 lines
4.2 KiB
RPMSpec
106 lines
4.2 KiB
RPMSpec
#
|
|
# spec file for package python-python-dbusmock
|
|
#
|
|
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
|
#
|
|
# All modifications and additions to the file contributed by third parties
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
# upon. The license for this file, and modifications and additions to the
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
# license for the pristine package is not an Open Source License, in which
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
# published by the Open Source Initiative.
|
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
|
|
|
|
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
|
%bcond_without test
|
|
Name: python-python-dbusmock
|
|
Version: 0.18.1
|
|
Release: 0
|
|
License: LGPL-3.0+
|
|
Summary: Mock D-Bus objects
|
|
Url: https://launchpad.net/python-dbusmock
|
|
Group: Development/Languages/Python
|
|
Source: https://files.pythonhosted.org/packages/source/p/python-dbusmock/python-dbusmock-%{version}.tar.gz
|
|
BuildRequires: %{python_module devel}
|
|
BuildRequires: %{python_module setuptools}
|
|
BuildRequires: fdupes
|
|
BuildRequires: python-rpm-macros
|
|
BuildRequires: pkgconfig(gobject-introspection-1.0)
|
|
%if %{with test}
|
|
BuildRequires: %{python_module nose}
|
|
BuildRequires: %{python_module dbus-python}
|
|
%endif
|
|
Requires: dbus-1-python
|
|
Requires: dbus-1-x11
|
|
Requires: python-gobject
|
|
Provides: python-dbusmock = %{version}
|
|
BuildArch: noarch
|
|
|
|
%python_subpackages
|
|
|
|
%description
|
|
With this program/Python library you can easily create mock objects on D-Bus.
|
|
This is useful for writing tests for software which talks to D-Bus services
|
|
such as upower, systemd, logind, gnome-session or others, and it is hard
|
|
(or impossible without root privileges) to set the state of the real services
|
|
to what you expect in your tests.
|
|
|
|
Suppose you want to write tests for gnome-settings-daemon's power plugin, or
|
|
another program that talks to upower. You want to verify that after the
|
|
configured idle time the program suspends the machine. So your program calls
|
|
``org.freedesktop.UPower.Suspend()`` on the system D-Bus.
|
|
|
|
Now, your test suite should not really talk to the actual system D-Bus and the
|
|
real upower; a ``make check`` that suspends your machine will not be considered
|
|
very friendly by most people, and if you want to run this in continuous
|
|
integration test servers or package build environments, chances are that your
|
|
process does not have the privilege to suspend, or there is no system bus or
|
|
upower to begin with. Likewise, there is no way for an user process to
|
|
forcefully set the system/seat idle flag in logind, so your
|
|
tests cannot set up the expected test environment on the real daemon.
|
|
|
|
That's where mock objects come into play: They look like the real API (or at
|
|
least the parts that you actually need), but they do not actually do anything
|
|
(or only some action that you specify yourself). You can configure their
|
|
state, behaviour and responses as you like in your test, without making any
|
|
assumptions about the real system status.
|
|
|
|
When using a local system/session bus, you can do unit or integration testing
|
|
without needing root privileges or disturbing a running system. The Python API
|
|
offers some convenience functions like ``start_session_bus()`` and
|
|
``start_system_bus()`` for this, in a ``DBusTestCase`` class (subclass of the
|
|
standard ``unittest.TestCase``).
|
|
|
|
You can use this with any programming language, as you can run the mocker as a
|
|
normal program. The actual setup of the mock (adding objects, methods,
|
|
properties, and signals) all happen via D-Bus methods on the
|
|
``org.freedesktop.DBus.Mock`` interface. You just don't have the convenience
|
|
D-Bus launch API that way.
|
|
|
|
%prep
|
|
%setup -q -n python-dbusmock-%{version}
|
|
|
|
%build
|
|
%python_build
|
|
|
|
%install
|
|
%python_install
|
|
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
|
|
|
%if %{with test}
|
|
%check
|
|
%python_exec setup.py test
|
|
%endif
|
|
|
|
%files %{python_files}
|
|
%defattr(-,root,root,-)
|
|
%doc COPYING NEWS README.rst
|
|
%{python_sitelib}/dbusmock/
|
|
%{python_sitelib}/python_dbusmock-%{version}-py*.egg-info
|
|
|
|
%changelog
|