mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-07-19 15:04:23 +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
|
site.retry
|
||||||
*__pycache__
|
*__pycache__
|
||||||
venv
|
venv
|
||||||
|
@ -88,7 +88,8 @@ class TestCreateDockerRoleCLI(unittest.TestCase):
|
|||||||
data['ports']['localhost']['http']['app2'] = 8001
|
data['ports']['localhost']['http']['app2'] = 8001
|
||||||
dump_yaml_with_comments(data, self.ports_file)
|
dump_yaml_with_comments(data, self.ports_file)
|
||||||
# Check comment and new entry
|
# 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('# existing port', text)
|
||||||
self.assertIn('app2: 8001', text)
|
self.assertIn('app2: 8001', text)
|
||||||
|
|
||||||
@ -128,7 +129,8 @@ class TestCreateDockerRoleCLI(unittest.TestCase):
|
|||||||
f.write('Line1\n')
|
f.write('Line1\n')
|
||||||
builtins.input = lambda _: '3'
|
builtins.input = lambda _: '3'
|
||||||
render_templates(src, dst, {})
|
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('Line1', content)
|
||||||
self.assertIn('Line2', content)
|
self.assertIn('Line2', content)
|
||||||
builtins.input = original_input
|
builtins.input = original_input
|
||||||
|
@ -49,7 +49,8 @@ class TestEnsureVarsMain(unittest.TestCase):
|
|||||||
vm = os.path.join(role, "vars", "main.yml")
|
vm = os.path.join(role, "vars", "main.yml")
|
||||||
self.assertTrue(os.path.exists(vm))
|
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'
|
# Expect application_id: 'foobar'
|
||||||
self.assertEqual(data.get("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)
|
run(prefix="desk-", preview=False, overwrite=True)
|
||||||
|
|
||||||
path = os.path.join(role, "vars", "main.yml")
|
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...
|
# application_id must be corrected...
|
||||||
self.assertEqual(data.get("application_id"), "baz")
|
self.assertEqual(data.get("application_id"), "baz")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user