Fix 2 ResourceWarning: unclosed file in test_ruamel_yaml.py (#19780)

Signed-off-by: Mickaël Schoentgen <contact@tiger-222.fr>
pull/19851/head
Mickaël Schoentgen 2019-01-07 17:53:31 +01:00 committed by Paulus Schoutsen
parent 9cdfa77a21
commit a57aae9891
1 changed files with 2 additions and 2 deletions

View File

@ -135,7 +135,7 @@ class TestYAML(unittest.TestCase):
def test_save_and_load(self):
"""Test saving and loading back."""
fname = self._path_for("test1")
open(fname, "w+")
open(fname, "w+").close()
util_yaml.save_yaml(fname, self.yaml.load(TEST_YAML_A))
data = util_yaml.load_yaml(fname, True)
assert data == self.yaml.load(TEST_YAML_A)
@ -143,7 +143,7 @@ class TestYAML(unittest.TestCase):
def test_overwrite_and_reload(self):
"""Test that we can overwrite an existing file and read back."""
fname = self._path_for("test2")
open(fname, "w+")
open(fname, "w+").close()
util_yaml.save_yaml(fname, self.yaml.load(TEST_YAML_A))
util_yaml.save_yaml(fname, self.yaml.load(TEST_YAML_B))
data = util_yaml.load_yaml(fname, True)