mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-08 11:18:02 +02:00
src/linux/integration-test: Do not crash on absent _outcomeForDoCleanups
unittest.TestCase unfortunately does not have any public API to check whether a test case succeeded, so we use the private self._outcomeForDoCleanups. This does not seem to exist every time, so avoid a crash if it doesn't.
This commit is contained in:
parent
88c6d141ef
commit
14761c09d2
1 changed files with 12 additions and 5 deletions
|
|
@ -88,11 +88,18 @@ class Tests(unittest.TestCase):
|
|||
shutil.rmtree(self.sysfs)
|
||||
|
||||
# on failures, print daemon log
|
||||
if not self._outcomeForDoCleanups.success:
|
||||
with open(self.log.name) as f:
|
||||
sys.stderr.write('\n-------------- daemon log: ----------------\n')
|
||||
sys.stderr.write(f.read())
|
||||
sys.stderr.write('------------------------------\n')
|
||||
try:
|
||||
if self._outcomeForDoCleanups.success:
|
||||
return
|
||||
except AttributeError:
|
||||
# _outcomeForDoCleanups is a private member which seems to be a bit
|
||||
# unreliable; if it does not exist, just ignore it
|
||||
return
|
||||
|
||||
with open(self.log.name) as f:
|
||||
sys.stderr.write('\n-------------- daemon log: ----------------\n')
|
||||
sys.stderr.write(f.read())
|
||||
sys.stderr.write('------------------------------\n')
|
||||
|
||||
#
|
||||
# Methods for fake sysfs
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue