From 0cf0cf7e42b62350fe6c8d6c2cbfb4e9c48a6f75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sat, 5 Sep 2015 14:18:32 +0200 Subject: tests: daemon.booted --- systemd/test/test_daemon.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'systemd/test') diff --git a/systemd/test/test_daemon.py b/systemd/test/test_daemon.py index 96c5717..c048929 100644 --- a/systemd/test/test_daemon.py +++ b/systemd/test/test_daemon.py @@ -1,10 +1,18 @@ import sys import os import posix -from systemd.daemon import _is_fifo, is_fifo, listen_fds +from systemd.daemon import _is_fifo, is_fifo, listen_fds, booted import pytest +def test_booted(): + if os.path.exists('/run/systemd'): + # assume we are running under systemd + assert booted() + else: + # don't assume anything + assert booted() in {False, True} + def test__is_fifo(tmpdir): path = tmpdir.join('test.fifo').strpath posix.mkfifo(path) -- cgit v1.2.1