linux: Create an empty configuration file for every test

This avoids a warning during startup, allowing enabling fatal-warnings
in more cases.
This commit is contained in:
Benjamin Berg 2022-05-09 21:02:08 +02:00
parent 0a1edd7916
commit f2da5678f3

View file

@ -188,8 +188,9 @@ class Tests(dbusmock.DBusTestCase):
When done, this sets self.proxy as the Gio.DBusProxy for upowerd.
'''
env = os.environ.copy()
if cfgfile is not None:
env['UPOWER_CONF_FILE_NAME'] = cfgfile
if not cfgfile:
_, cfgfile = tempfile.mkstemp(prefix='upower-cfg-')
self.addCleanup(os.unlink, cfgfile)
env['G_DEBUG'] = 'fatal-criticals'
# note: Python doesn't propagate the setenv from Testbed.new(), so we
# have to do that ourselves