forked from pool/python-systemd
- Add fix_test_reader_this_machine.patch to make
test_reader_this_machine pass in the limited build environment. - Do not pull in whole systemd, when just libsystemd0 is enough (bsc#1215538). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-systemd?expand=0&rev=29
This commit is contained in:
parent
4c4b57ba8e
commit
bfb15f2c94
@ -6,14 +6,12 @@ Subject: [PATCH] tests: check for errnos that sd_id128_get_machine actually
|
|||||||
|
|
||||||
Fixes #118.
|
Fixes #118.
|
||||||
---
|
---
|
||||||
systemd/test/test_id128.py | 7 ++++---
|
systemd/test/test_id128.py | 11 +++++++----
|
||||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
1 file changed, 7 insertions(+), 4 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
|
--- a/systemd/test/test_id128.py
|
||||||
+++ b/systemd/test/test_id128.py
|
+++ b/systemd/test/test_id128.py
|
||||||
@@ -6,11 +6,11 @@
|
@@ -6,11 +6,11 @@ import pytest
|
||||||
from systemd import id128
|
from systemd import id128
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
@ -27,13 +25,24 @@ index 146ec73..f5fc65f 100644
|
|||||||
pytest.skip()
|
pytest.skip()
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@@ -29,7 +29,8 @@ def test_get_machine_app_specific():
|
@@ -21,7 +21,10 @@ def test_randomize():
|
||||||
|
assert u1 != u2
|
||||||
|
|
||||||
|
def test_get_machine():
|
||||||
|
- u1 = id128.get_machine()
|
||||||
|
+ # yikes, python2 doesn't know ENOMEDIUM
|
||||||
|
+ with skip_oserror(errno.ENOENT, errno.ENOSYS, 123):
|
||||||
|
+ u1 = id128.get_machine()
|
||||||
|
+
|
||||||
|
u2 = id128.get_machine()
|
||||||
|
assert u1 == u2
|
||||||
|
|
||||||
|
@@ -29,7 +32,7 @@ def test_get_machine_app_specific():
|
||||||
a1 = uuid.uuid1()
|
a1 = uuid.uuid1()
|
||||||
a2 = uuid.uuid1()
|
a2 = uuid.uuid1()
|
||||||
|
|
||||||
- with skip_oserror(errno.ENOSYS):
|
- with skip_oserror(errno.ENOSYS):
|
||||||
+ # yikes, python2 doesn't know ENOMEDIUM
|
+ with skip_oserror(errno.ENOENT, errno.ENOSYS, 123):
|
||||||
+ with skip_oserror(errno.ENOENT, 123):
|
|
||||||
u1 = id128.get_machine_app_specific(a1)
|
u1 = id128.get_machine_app_specific(a1)
|
||||||
|
|
||||||
u2 = id128.get_machine_app_specific(a2)
|
u2 = id128.get_machine_app_specific(a2)
|
||||||
|
34
fix_test_reader_this_machine.patch
Normal file
34
fix_test_reader_this_machine.patch
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
---
|
||||||
|
systemd/test/test_journal.py | 11 ++++++-----
|
||||||
|
1 file changed, 6 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
--- a/systemd/test/test_journal.py
|
||||||
|
+++ b/systemd/test/test_journal.py
|
||||||
|
@@ -43,11 +43,11 @@ class MockSender:
|
||||||
|
self.buf.append(args)
|
||||||
|
|
||||||
|
@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
|
||||||
|
|
||||||
|
@@ -233,9 +233,10 @@ def test_reader_this_boot(tmpdir):
|
||||||
|
def test_reader_this_machine(tmpdir):
|
||||||
|
j = journal.Reader(path=tmpdir.strpath)
|
||||||
|
with j:
|
||||||
|
- j.this_machine()
|
||||||
|
- j.this_machine(TEST_MID)
|
||||||
|
- j.this_machine(TEST_MID.hex)
|
||||||
|
+ with skip_oserror(errno.ENOENT, errno.ENOSYS, 123):
|
||||||
|
+ j.this_machine()
|
||||||
|
+ j.this_machine(TEST_MID)
|
||||||
|
+ j.this_machine(TEST_MID.hex)
|
||||||
|
|
||||||
|
def test_reader_query_unique(tmpdir):
|
||||||
|
j = journal.Reader(path=tmpdir.strpath)
|
@ -1,3 +1,11 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon May 13 18:03:23 UTC 2024 - Matej Cepl <mcepl@cepl.eu>
|
||||||
|
|
||||||
|
- Add fix_test_reader_this_machine.patch to make
|
||||||
|
test_reader_this_machine pass in the limited build environment.
|
||||||
|
- Do not pull in whole systemd, when just libsystemd0 is enough
|
||||||
|
(bsc#1215538).
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sun Jun 11 14:08:18 UTC 2023 - ecsos <ecsos@opensuse.org>
|
Sun Jun 11 14:08:18 UTC 2023 - ecsos <ecsos@opensuse.org>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-systemd
|
# spec file for package python-systemd
|
||||||
#
|
#
|
||||||
# Copyright (c) 2022 SUSE LLC
|
# Copyright (c) 2024 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -30,6 +30,9 @@ Patch1: iso-c-90.patch
|
|||||||
# PATCH-FIX-OPENSUSE OBS_missing_etc_machine_id.patch gh#systemd/python-systemd#118 mcepl@suse.com
|
# 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
|
# build environment doesn't have /etc/machine-id
|
||||||
Patch2: OBS_missing_etc_machine_id.patch
|
Patch2: OBS_missing_etc_machine_id.patch
|
||||||
|
# PATCH-FIX-UPSTREAM fix_test_reader_this_machine.patch mcepl@suse.com
|
||||||
|
# make test_reader_this_machine test pass in the limited build environment
|
||||||
|
Patch3: fix_test_reader_this_machine.patch
|
||||||
BuildRequires: %{python_module devel}
|
BuildRequires: %{python_module devel}
|
||||||
BuildRequires: %{python_module pip}
|
BuildRequires: %{python_module pip}
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
@ -39,7 +42,7 @@ BuildRequires: gcc-c++
|
|||||||
BuildRequires: pkgconfig
|
BuildRequires: pkgconfig
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
BuildRequires: pkgconfig(libsystemd)
|
BuildRequires: pkgconfig(libsystemd)
|
||||||
Requires: systemd
|
Requires: libsystemd0
|
||||||
Suggests: %{name}-doc
|
Suggests: %{name}-doc
|
||||||
# /SECTION
|
# /SECTION
|
||||||
BuildRequires: %{python_module pytest}
|
BuildRequires: %{python_module pytest}
|
||||||
@ -64,7 +67,7 @@ Python module for native access to the systemd facilities. Functionality is sepe
|
|||||||
|
|
||||||
%check
|
%check
|
||||||
# Not sure about the first exclusion,
|
# Not sure about the first exclusion,
|
||||||
export PYTEST_ADDOPTS="-k 'not (test_reader_this_machine or test_get_machine)'"
|
# export PYTEST_ADDOPTS="-k 'not (test_reader_this_machine or test_get_machine)'"
|
||||||
%python_expand make PYTHON=python%{$python_version} check
|
%python_expand make PYTHON=python%{$python_version} check
|
||||||
|
|
||||||
%files %{python_files}
|
%files %{python_files}
|
||||||
|
Loading…
Reference in New Issue
Block a user