Commit 53d9f55e authored by Bastien Nocera's avatar Bastien Nocera
Browse files

tests: Fix error running tests with Python 3.11

In https://github.com/python/cpython/commit/664448d81f41c5fa971d8523a71b0f19e76cc136
the "errors" attribute was removed from the _Outcome object. Adapt the
code to print the daemon log after a failed run().
parent d72a30cf
Pipeline #621114 passed with stage
in 1 minute and 11 seconds
......@@ -116,6 +116,14 @@ class Tests(dbusmock.DBusTestCase):
# Used for dytc devices
self.tp_acpi = None
def run(self, result=None):
super(Tests, self).run(result)
if result and len(result.errors) + len(result.failures) > 0 and self.log:
with open(self.log.name) as f:
sys.stderr.write('\n-------------- daemon log: ----------------\n')
sys.stderr.write(f.read())
sys.stderr.write('------------------------------\n')
def tearDown(self):
del self.testbed
self.stop_daemon()
......@@ -135,14 +143,6 @@ class Tests(dbusmock.DBusTestCase):
except Exception:
pass
# on failures, print daemon log
errors = [x[1] for x in self._outcome.errors if x[1]]
if errors and self.log:
with open(self.log.name) as f:
sys.stderr.write('\n-------------- daemon log: ----------------\n')
sys.stderr.write(f.read())
sys.stderr.write('------------------------------\n')
#
# Daemon control and D-BUS I/O
#
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment