1
0
python-systemd/fix_test_reader_this_machine.patch
Matej Cepl bfb15f2c94 - 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
2024-05-13 18:04:54 +00:00

35 lines
999 B
Diff

---
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)