Commit graph

268 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
5211952348 tests: use a context manager, skip new functions if missing 2016-09-21 15:32:58 -04:00
Zbigniew Jędrzejewski-Szmek
02b9432e73 reader: add SD_JOURNAL_OS_ROOT and rework flag passing
Let's pass any flags through to the journal functions without checking
validity. Those functions do their own checking, so there's no need to
second-guess.

The semantics for _Reader(flags=0) are a bit changed:
before, this would be transformed into sd_journal_open(SD_J_LOCAL_ONLY).
Now, this results in sd_journal_open(0). Previous behaviour should be
achieved by not specifying the flags at all.
This change is necessary, because previously it was not possible to
pass flags=0 to sd_journal_open(0), i.e. it was not possible to "merge"
journals through the Python interface.

Similarly, Reader(flags=0) now means to open all journals, and
Reader(flags=None) is the same as Reader(flags=LOCAL_ONLY).
2016-09-21 15:32:58 -04:00
Zbigniew Jędrzejewski-Szmek
89badf50b7 journal: add support for sd_journal_open_files_fd 2016-09-21 15:32:58 -04:00
Zbigniew Jędrzejewski-Szmek
ee9ab0bd65 journal: make sd_journal_enumerate return text strings
Those are field names and they should always be ASCII, and converting
them to str automatically makes the answer more useful.
2016-09-21 15:32:58 -04:00
Zbigniew Jędrzejewski-Szmek
dadcd3d723 journal: allow sd_journal_open_directory_fd to be used 2016-09-21 15:32:58 -04:00
Zbigniew Jędrzejewski-Szmek
42f627b302 Reformat documentation to be more PEP257-compliant
Wrapping the sources to ~80 columns means that the formatted output is
annoying to read. Rewrap to ~74 columns in the output.

Also remove some obsolete descritions of journal permissions and refer
to journalctl(1) instead.

Add some missing docstrings.
2016-09-20 09:38:36 -04:00
Zbigniew Jędrzejewski-Szmek
814cdb9d6a tests: check enumerate_fields, has_runtime_fiels, has_persistent_files 2016-09-20 09:38:18 -04:00
Zbigniew Jędrzejewski-Szmek
36a384a683 journal: add wrappers for sd_has_*_files 2016-09-20 09:38:14 -04:00
Zbigniew Jędrzejewski-Szmek
819ea77d1b journal: add wrapper for sd_journal_enumerate 2016-09-20 09:38:10 -04:00
Zbigniew Jędrzejewski-Szmek
ffba3a2ff8 journal: check errors properly in query_unique 2016-09-20 09:38:03 -04:00
Sebastian
8583a45b5c Makefile: correct path to generated docs 2016-09-15 22:31:21 +02:00
Sebastian
2e3512c656 Add Docs to README 2016-09-15 22:29:25 +02:00
Michael Biebl
4c6072f61b Fix typo (#26) 2016-07-16 11:20:52 -04:00
Benedikt Morbach
25f22209ea setup.py: respect ${PKG_CONFIG} if set (#18) 2016-05-28 16:38:02 -04:00
Nir Soffer
44acd1c9d1 readme: Use "raised" instead of "thrown"
Should be more familiar to the users of this library.
2016-05-28 22:48:11 +03:00
Nir Soffer
9fd0159c47 readme: Remove duplicate 'is thrown' 2016-05-28 22:45:16 +03:00
Ville Skyttä
4c5e850b49 Use log.warning instead of deprecated log.warn in example code 2016-05-21 08:50:13 +03:00
Ville Skyttä
947f782886 Spelling fixes 2016-05-21 08:47:00 +03:00
Mike Gilbert
87a9d64550 test_daemon: Define a default value for SO_PASSCRED
The socket module seems to be missing this in python2.7.
2016-01-20 19:08:02 -05:00
Michael Herold
3d046016c4 Fixes Reader.seek_monotonic(datetime.timedelta) 2015-12-10 00:18:01 +01:00
Zbigniew Jędrzejewski-Szmek
c8749e7fbc reader: avoid gcc warning
gcc warns that r might be uninitialized, because it doesn't
know that r will be initialized in the 'if' statement.

Initialize the variable to avoid the warning.
2015-12-02 20:44:15 -05:00
Zbigniew Jędrzejewski-Szmek
8ccd64789a tests: mirror is-systemd-running test from systemd v231 2015-10-28 10:02:53 -04:00
Zbigniew Jędrzejewski-Szmek
644e11f398 build-sys: make sure we use modules from the build dir
When running form the top source directory, sometimes modules
from systemd/ and not build/*/systemd/ were loaded.
2015-10-28 09:54:11 -04:00
Zbigniew Jędrzejewski-Szmek
94ee7ed0f9 build-sys: name html build directory after format
This way different outputs don't land in the same place.
2015-10-28 09:46:09 -04:00
Zbigniew Jędrzejewski-Szmek
45295d1b59 Bump version to 231 2015-10-27 08:25:15 -04:00
Zbigniew Jędrzejewski-Szmek
8176439058 build-sys: also put pytest.ini in the tarball
Without this tests don't seem to run properly with a build dir.
2015-10-27 08:17:58 -04:00
Zbigniew Jędrzejewski-Szmek
8d55a298d9 docs: remove SD_MESSAGE_CONFIG_ERROR from list
This list should be auto-generated... Let's remove the
ID that was removed from systemd from here too for now.
2015-10-27 00:26:37 -04:00
Zbigniew Jędrzejewski-Szmek
0576d32ed4 Add NEWS file 2015-10-27 00:13:38 -04:00
Zbigniew Jędrzejewski-Szmek
d31bfc3ba6 build-sys: add utility target to run tests 2015-10-27 00:12:11 -04:00
Zbigniew Jędrzejewski-Szmek
c1c55294f1 build-sys: add utility target to build TAGS 2015-10-27 00:07:18 -04:00
Zbigniew Jędrzejewski-Szmek
f83f19b3bd Python2 does not have ConnectionError 2015-10-27 00:07:18 -04:00
Zbigniew Jędrzejewski-Szmek
3217d17d0c build-sys: include tests in installation
This also allows tests to be run against he build directory:
$ py.test-2.7 -v build/lib.linux-x86_64-2.7 docs
$ py.test-3.4 -v build/lib.linux-x86_64-3.4 docs
2015-10-27 00:07:18 -04:00
Zbigniew Jędrzejewski-Szmek
a947f32b31 tests: add tests for notify() 2015-10-26 23:38:58 -04:00
Zbigniew Jędrzejewski-Szmek
6baa4b417b daemon: wrap sd_pid_notify[_with_pids]
Closes #8.
2015-10-26 22:51:27 -04:00
Zbigniew Jędrzejewski-Szmek
035700c2b5 Merge branch 'tests' 2015-10-25 16:51:04 -04:00
Zbigniew Jędrzejewski-Szmek
1d8f5f26df tests: work around bug in sd_is_mq
The fix was committed in v226-362-g0260d1d542.
2015-10-25 16:50:59 -04:00
Zbigniew Jędrzejewski-Szmek
4be2fc75bf Do not assume specific output from the journal
While we *usually* get those messages from udev, in many tests environments
this will not be true, so just do not try to check the output at all.
2015-10-25 12:23:29 -04:00
Zbigniew Jędrzejewski-Szmek
2e3e9748d4 build-sys: replace loop with list comprehension 2015-10-25 11:56:13 -04:00
Jeroen Dekkers
718cefefcd build-sys: generate systemd/id128-constants.h in setup.py
Fixes #7.
2015-10-25 11:55:48 -04:00
Zbigniew Jędrzejewski-Szmek
173c2a89b2 tests: add simplistic tests for Reader matches
It would be nice to run those tests against fake journal files
with the right content to actually test the matches. But those
tests are still useful because they test that the interface
works as expected.
2015-09-16 12:43:06 +02:00
Zbigniew Jędrzejewski-Szmek
4f5aa7b54a journal: allow numbers in field identifiers 2015-09-17 11:53:45 +02:00
Zbigniew Jędrzejewski-Szmek
bbbc6e8a92 tests: add tests for Reader initialization 2015-09-17 11:53:45 +02:00
Zbigniew Jędrzejewski-Szmek
008aac74d7 journal: reindent to 4 spaces 2015-09-17 11:53:45 +02:00
Zbigniew Jędrzejewski-Szmek
5bf468dca1 tests: start adding tests for JournalHandler 2015-09-17 11:53:45 +02:00
Zbigniew Jędrzejewski-Szmek
5f36e8647a Normalize some strange indentation 2015-09-08 10:36:16 +02:00
Zbigniew Jędrzejewski-Szmek
085db21e5e tests: add more tests for socket functions 2015-09-06 18:54:55 +02:00
Zbigniew Jędrzejewski-Szmek
e6b305b41a tests: adapt to python2.7 output again 2015-09-05 14:23:20 +02:00
Zbigniew Jędrzejewski-Szmek
0cf0cf7e42 tests: daemon.booted 2015-09-05 14:18:32 +02:00
Zbigniew Jędrzejewski-Szmek
2e115f3c4f tests: daemon.listen_fds 2015-09-05 14:18:23 +02:00
Zbigniew Jędrzejewski-Szmek
c76c5f0ef7 tests: fix test discovery by pytest 2015-09-05 13:47:47 +02:00