mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-07-17 05:54:24 +02:00
Solved unclosed file <_io.TextIOWrapper warnings
This commit is contained in:
parent
e4ce3848fc
commit
dea2669de2
@ -1,3 +1,7 @@
|
||||
# The .gitignore is the single point of truth for files which should be ignored.
|
||||
# Add patterns, files and folders to the .gitignore and execute 'make build'
|
||||
# NEVER TOUCH THE .dockerignore, BECAUSE IT ANYHOW WILL BE OVERWRITTEN
|
||||
|
||||
site.retry
|
||||
*__pycache__
|
||||
venv
|
||||
|
@ -88,7 +88,8 @@ class TestCreateDockerRoleCLI(unittest.TestCase):
|
||||
data['ports']['localhost']['http']['app2'] = 8001
|
||||
dump_yaml_with_comments(data, self.ports_file)
|
||||
# Check comment and new entry
|
||||
text = open(self.ports_file).read()
|
||||
with open(self.ports_file) as f:
|
||||
text = f.read()
|
||||
self.assertIn('# existing port', text)
|
||||
self.assertIn('app2: 8001', text)
|
||||
|
||||
@ -128,7 +129,8 @@ class TestCreateDockerRoleCLI(unittest.TestCase):
|
||||
f.write('Line1\n')
|
||||
builtins.input = lambda _: '3'
|
||||
render_templates(src, dst, {})
|
||||
content = open(out_file).read().splitlines()
|
||||
with open(out_file) as f:
|
||||
content = f.read().splitlines()
|
||||
self.assertIn('Line1', content)
|
||||
self.assertIn('Line2', content)
|
||||
builtins.input = original_input
|
||||
|
@ -49,7 +49,8 @@ class TestEnsureVarsMain(unittest.TestCase):
|
||||
vm = os.path.join(role, "vars", "main.yml")
|
||||
self.assertTrue(os.path.exists(vm))
|
||||
|
||||
data = yaml.safe_load(open(vm))
|
||||
with open(vm) as f:
|
||||
data = yaml.safe_load(f)
|
||||
# Expect application_id: 'foobar'
|
||||
self.assertEqual(data.get("application_id"), "foobar")
|
||||
|
||||
@ -61,7 +62,8 @@ class TestEnsureVarsMain(unittest.TestCase):
|
||||
run(prefix="desk-", preview=False, overwrite=True)
|
||||
|
||||
path = os.path.join(role, "vars", "main.yml")
|
||||
data = yaml.safe_load(open(path))
|
||||
with open(path) as f:
|
||||
data = yaml.safe_load(f)
|
||||
|
||||
# application_id must be corrected...
|
||||
self.assertEqual(data.get("application_id"), "baz")
|
||||
|
Loading…
x
Reference in New Issue
Block a user