diff options
author | Benjamin Berg <bberg@redhat.com> | 2020-12-02 17:59:09 +0100 |
---|---|---|
committer | Benjamin Berg <bberg@redhat.com> | 2021-02-15 17:29:27 +0100 |
commit | 1041871503d1bb3a6836372e9f05ac99948c573c (patch) | |
tree | ca2802f4cf88008b793e9a78d58fa9f4ab20e54a /tests | |
parent | d26394ae051dd7854e81bff88f2d10899f986bea (diff) | |
download | gnome-settings-daemon-1041871503d1bb3a6836372e9f05ac99948c573c.tar.gz |
tests: Port tests to use new OutputChecker class
This improves readabilty and means that all output is logged to stdout
(almost) immediately instead of splitting it into files which
potentially causes extra confusion.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gsdtestcase.py | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/tests/gsdtestcase.py b/tests/gsdtestcase.py index 28068f6f..6c7168f9 100644 --- a/tests/gsdtestcase.py +++ b/tests/gsdtestcase.py @@ -14,6 +14,8 @@ import shutil import sys from glob import glob +from output_checker import OutputChecker + from gi.repository import GLib try: @@ -166,9 +168,11 @@ class GSDTestCase(X11SessionTestCase): if parameters is None: parameters = {} + self.logind_log = OutputChecker() self.logind, self.logind_obj = self.spawn_server_template('logind', parameters, - stdout=subprocess.PIPE) + stdout=self.logind_log.fd) + self.logind_log.writer_attached() # Monkey patch SuspendThenHibernate functions in for dbusmock <= 0.17.2 # This should be removed once we can depend on dbusmock 0.17.3 @@ -177,24 +181,21 @@ class GSDTestCase(X11SessionTestCase): self.logind_obj.AddMethod('org.freedesktop.login1.Session', 'SetBrightness', 'ssu', '', '') - # set log to nonblocking - set_nonblock(self.logind.stdout) - def stop_logind(self): '''stop mock logind''' self.logind.terminate() self.logind.wait() + self.logind_log.assert_closed() def start_mutter(klass): ''' start mutter ''' os.environ['MUTTER_DEBUG_RESET_IDLETIME']='1' - klass.mutter_log = open(os.path.join(klass.workdir, 'mutter.log'), 'wb', buffering=0) # See https://gitlab.gnome.org/GNOME/mutter/merge_requests/15 - klass.mutter = subprocess.Popen(['mutter', '--x11'], - stdout=klass.mutter_log, - stderr=subprocess.STDOUT) + klass.mutter = subprocess.Popen(['mutter', '--x11']) + klass.wait_for_bus_object('org.gnome.Mutter.IdleMonitor', + '/org/gnome/Mutter/IdleMonitor/Core') def stop_mutter(klass): '''stop mutter''' @@ -203,9 +204,6 @@ class GSDTestCase(X11SessionTestCase): klass.mutter.terminate() klass.mutter.wait() - klass.mutter_log.flush() - klass.mutter_log.close() - @classmethod def reset_idle_timer(klass): '''trigger activity to reset idle timer''' |