From 9eedff97a6afed3c18bc268c90e0ed10f253dd68 Mon Sep 17 00:00:00 2001 From: Steven Robertson Date: Sat, 15 Feb 2020 15:40:10 -0800 Subject: [PATCH] closed fp after writing to temp files --- tests/ansible/integration/action/make_tmp_path.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/ansible/integration/action/make_tmp_path.yml b/tests/ansible/integration/action/make_tmp_path.yml index 73aa1187..f8dc01c0 100644 --- a/tests/ansible/integration/action/make_tmp_path.yml +++ b/tests/ansible/integration/action/make_tmp_path.yml @@ -94,7 +94,8 @@ from ansible.module_utils.basic import get_module_path path = get_module_path() + '/foo.txt' result['path'] = path - open(path, 'w').write("bar") + with open(path, 'w') as f: + f.write("bar") register: out - name: "Verify junk disappeared." @@ -136,7 +137,8 @@ from ansible.module_utils.basic import get_module_path path = get_module_path() + '/foo.txt' result['path'] = path - open(path, 'w').write("bar") + with open(path, 'w') as f: + f.write("bar") register: tmp_path #