Fix test_fix_argument_yes by closing temp files
The test was randomly failing which could be caused by a race
condition - the temporary files which are created during the
test weren't closed properly which could result in a situation
when they are not yet created but the test is trying to load
them.
Closes-Bug: #1918316
Change-Id: I7a5bf8b1404dbf96955b2eb96fb1a5552760a114
diff --git a/tempest/tests/lib/cmd/test_check_uuid.py b/tempest/tests/lib/cmd/test_check_uuid.py
index a621a75..403de38 100644
--- a/tempest/tests/lib/cmd/test_check_uuid.py
+++ b/tempest/tests/lib/cmd/test_check_uuid.py
@@ -29,12 +29,13 @@
" pass"
def create_tests_file(self, directory):
- with open(directory + "/__init__.py", "w"):
- pass
+ init_file = open(directory + "/__init__.py", "w")
+ init_file.close()
tests_file = directory + "/tests.py"
with open(tests_file, "w") as fake_file:
fake_file.write(TestCLInterface.CODE)
+ fake_file.close()
return tests_file