summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-09-05 13:33:40 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-09-05 13:33:40 +0200
commit26a9c1f18ad2ef63fb3f2676c5ad8f6a565054e8 (patch)
treea2e0e4bff9b13051a6bf12e7bf43c311b46e962d
parentcc5f218a5082bd8a52f80d1bedad7bd4f78bca5e (diff)
downloadpython-systemd-26a9c1f18ad2ef63fb3f2676c5ad8f6a565054e8.tar.gz
tests: also collect doctests from rst
There isn't much to test now, but it doesn't hurt to enable.
-rw-r--r--docs/journal.rst38
-rw-r--r--docs/login.rst6
-rw-r--r--pytest.ini2
3 files changed, 40 insertions, 6 deletions
diff --git a/docs/journal.rst b/docs/journal.rst
index ea74cf8..8e4b5b6 100644
--- a/docs/journal.rst
+++ b/docs/journal.rst
@@ -41,11 +41,45 @@ event loop:
>>> from systemd import journal
>>> j = journal.Reader()
>>> j.seek_tail()
+ >>> journal.send('testing 1,2,3') # make sure we have something to read
+ >>> j.add_match('MESSAGE=testing 1,2,3')
>>> p = select.poll()
>>> p.register(j, j.get_events())
- >>> p.poll()
+ >>> p.poll() # doctest: +SKIP
[(3, 1)]
- >>> j.get_next()
+ >>> j.get_next() # doctest: +SKIP
+ {'_AUDIT_LOGINUID': 1000,
+ '_CAP_EFFECTIVE': '0',
+ '_SELINUX_CONTEXT': 'unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023',
+ '_GID': 1000,
+ 'CODE_LINE': 1,
+ '_HOSTNAME': '...',
+ '_SYSTEMD_SESSION': 52,
+ '_SYSTEMD_OWNER_UID': 1000,
+ 'MESSAGE': 'testing 1,2,3',
+ '__MONOTONIC_TIMESTAMP':
+ journal.Monotonic(timestamp=datetime.timedelta(2, 76200, 811585),
+ bootid=UUID('958b7e26-df4c-453a-a0f9-a8406cb508f2')),
+ 'SYSLOG_IDENTIFIER': 'python3',
+ '_UID': 1000,
+ '_EXE': '/usr/bin/python3',
+ '_PID': 7733,
+ '_COMM': '...',
+ 'CODE_FUNC': '<module>',
+ 'CODE_FILE': '<doctest journal.rst[4]>',
+ '_SOURCE_REALTIME_TIMESTAMP':
+ datetime.datetime(2015, 9, 5, 13, 17, 4, 944355),
+ '__CURSOR': 's=...',
+ '_BOOT_ID': UUID('958b7e26-df4c-453a-a0f9-a8406cb508f2'),
+ '_CMDLINE': '/usr/bin/python3 ...',
+ '_MACHINE_ID': UUID('263bb31e-3e13-4062-9bdb-f1f4518999d2'),
+ '_SYSTEMD_SLICE': 'user-1000.slice',
+ '_AUDIT_SESSION': 52,
+ '__REALTIME_TIMESTAMP': datetime.datetime(2015, 9, 5, 13, 17, 4, 945110),
+ '_SYSTEMD_UNIT': 'session-52.scope',
+ '_SYSTEMD_CGROUP': '/user.slice/user-1000.slice/session-52.scope',
+ '_TRANSPORT': 'journal'}
+
Journal access types
diff --git a/docs/login.rst b/docs/login.rst
index 6b4de64..2ee807c 100644
--- a/docs/login.rst
+++ b/docs/login.rst
@@ -20,9 +20,9 @@ external event loop:
>>> m = login.Monitor("machine")
>>> p = select.poll()
>>> p.register(m, m.get_events())
- >>> login.machine_names()
+ >>> login.machine_names() # doctest: +SKIP
[]
- >>> p.poll()
+ >>> p.poll() # doctest: +SKIP
[(3, 1)]
- >>> login.machine_names()
+ >>> login.machine_names() # doctest: +SKIP
['fedora-19.nspawn']
diff --git a/pytest.ini b/pytest.ini
index df3eb51..5ca50a5 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -1,2 +1,2 @@
[pytest]
-addopts = --doctest-modules
+addopts = --doctest-modules --doctest-glob=*.rst