Accepting request 998995 from devel:languages:python

Automatic submission by obs-autosubmit

OBS-URL: https://build.opensuse.org/request/show/998995
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-systemd?expand=0&rev=12
This commit is contained in:
Dominique Leuenberger 2022-08-24 13:11:42 +00:00 committed by Git OBS Bridge
commit 7a09a27615
3 changed files with 53 additions and 4 deletions

View File

@ -0,0 +1,39 @@
From 50d1ec8ab8d3333ef1b7cac982155b94c7534c4c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 17 Aug 2022 09:53:25 +0200
Subject: [PATCH] tests: check for errnos that sd_id128_get_machine actually
returns
Fixes #118.
---
systemd/test/test_id128.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/systemd/test/test_id128.py b/systemd/test/test_id128.py
index 146ec73..f5fc65f 100644
--- a/systemd/test/test_id128.py
+++ b/systemd/test/test_id128.py
@@ -6,11 +6,11 @@
from systemd import id128
@contextlib.contextmanager
-def skip_oserror(code):
+def skip_oserror(*errnos):
try:
yield
except (OSError, IOError) as e:
- if e.errno == code:
+ if e.errno in errnos:
pytest.skip()
raise
@@ -29,7 +29,8 @@ def test_get_machine_app_specific():
a1 = uuid.uuid1()
a2 = uuid.uuid1()
- with skip_oserror(errno.ENOSYS):
+ # yikes, python2 doesn't know ENOMEDIUM
+ with skip_oserror(errno.ENOENT, 123):
u1 = id128.get_machine_app_specific(a1)
u2 = id128.get_machine_app_specific(a2)

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Aug 17 09:03:29 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Add OBS_missing_etc_machine_id.patch to partially fix
gh#systemd/python-systemd#118.
-------------------------------------------------------------------
Wed Aug 17 05:49:41 UTC 2022 - Matej Cepl <mcepl@suse.com>

View File

@ -27,8 +27,13 @@ URL: https://github.com/systemd/python-systemd
Source: https://github.com/systemd/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
# PATCH-FIX-OPENSUSE iso-c-90.patch makes the building iso-c-90 compatible to allow building on SLE12 SP3
Patch1: iso-c-90.patch
# PATCH-FIX-OPENSUSE OBS_missing_etc_machine_id.patch gh#systemd/python-systemd#118 mcepl@suse.com
# build environment doesn't have /etc/machine-id
Patch2: OBS_missing_etc_machine_id.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: pkgconfig
@ -51,16 +56,15 @@ Python module for native access to the systemd facilities. Functionality is sepe
%autosetup -p1
%build
%python_build
%pyproject_wheel
%install
%python_install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitearch}
%check
# Not sure about the first exclusion,
# the following ones are gh#systemd/python-systemd#118
export PYTEST_ADDOPTS="-k 'not (test_reader_this_machine or test_get_machine or test_get_machine_app_specific)'"
export PYTEST_ADDOPTS="-k 'not (test_reader_this_machine or test_get_machine)'"
%python_expand make PYTHON=python%{$python_version} check
%files %{python_files}