diff --git a/tripleoclient/tests/test_utils.py b/tripleoclient/tests/test_utils.py index 7486edd3a..bd4374dea 100644 --- a/tripleoclient/tests/test_utils.py +++ b/tripleoclient/tests/test_utils.py @@ -546,7 +546,8 @@ class TestCreateOvercloudRC(TestCase): try: utils.write_overcloudrc(stack_name, overcloudrcs, config_directory=tempdir) - rc = open(rcfile, 'rt').read() + with open(rcfile, 'rt') as f: + rc = f.read() self.assertEqual('overcloudrc', rc) finally: if os.path.exists(rcfile): @@ -561,7 +562,8 @@ class TestCreateTempestDeployerInput(TestCase): with tempfile.NamedTemporaryFile() as cfgfile: filepath = cfgfile.name utils.create_tempest_deployer_input(filepath) - cfg = open(filepath, 'rt').read() + with open(filepath, 'rt') as f: + cfg = f.read() # Just make a simple test, to make sure it created a proper file: self.assertIn( '[volume-feature-enabled]\nbootable = true', cfg)