Merge "Fix 'consider-using-with' warning"

This commit is contained in:
Zuul 2023-06-02 17:17:48 +00:00 committed by Gerrit Code Review
commit 8c4f312f81

View File

@ -53,9 +53,8 @@ class TestUtils(base.BaseTestCase):
def test_get_system_dns_resolvers(self):
tempdir = self.useFixture(fixtures.TempDir()).path
resolver_file_name = tempdir + '/resolv.conf'
tmp_resolv_file = open(resolver_file_name, 'w')
tmp_resolv_file.writelines(RESOLV_CONF_TEMPLATE)
tmp_resolv_file.close()
with open(resolver_file_name, 'w') as f:
f.writelines(RESOLV_CONF_TEMPLATE)
expected_dns_resolvers = RESOLV_DNS_SERVERS
observed_dns_resolvers = utils.get_system_dns_resolvers(
resolver_file=resolver_file_name)