Skip to content

Commit 814cdb9

Browse files
committed
tests: check enumerate_fields, has_runtime_fiels, has_persistent_files
1 parent 36a384a commit 814cdb9

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

systemd/test/test_journal.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import logging
22
import uuid
3+
import errno
34
from systemd import journal, id128
45

56
import pytest
@@ -80,6 +81,52 @@ def test_reader_this_machine(tmpdir):
8081
j.this_machine(TEST_MID)
8182
j.this_machine(TEST_MID.hex)
8283

84+
def test_reader_query_unique(tmpdir):
85+
j = journal.Reader(path=tmpdir.strpath)
86+
with j:
87+
try:
88+
ans = j.query_unique('FOOBAR')
89+
except OSError as e:
90+
if e.errno == errno.ENOSYS:
91+
return
92+
raise
93+
assert isinstance(ans, set)
94+
assert ans == set()
95+
96+
def test_reader_enumerate_fields(tmpdir):
97+
j = journal.Reader(path=tmpdir.strpath)
98+
with j:
99+
try:
100+
ans = j.enumerate_fields()
101+
except OSError as e:
102+
if e.errno == errno.ENOSYS:
103+
pytest.skip()
104+
raise
105+
assert isinstance(ans, set)
106+
assert ans == set()
107+
108+
def test_reader_has_runtime_files(tmpdir):
109+
j = journal.Reader(path=tmpdir.strpath)
110+
with j:
111+
try:
112+
ans = j.has_runtime_files()
113+
except OSError as e:
114+
if e.errno == errno.ENOSYS:
115+
pytest.skip()
116+
raise
117+
assert ans == False
118+
119+
def test_reader_has_persistent_files(tmpdir):
120+
j = journal.Reader(path=tmpdir.strpath)
121+
with j:
122+
try:
123+
ans = j.has_runtime_files()
124+
except OSError as e:
125+
if e.errno == errno.ENOSYS:
126+
pytest.skip()
127+
raise
128+
assert ans == False
129+
83130
def test_reader_converters(tmpdir):
84131
converters = {'xxx' : lambda arg: 'yyy'}
85132
j = journal.Reader(path=tmpdir.strpath, converters=converters)

0 commit comments

Comments
 (0)