summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/service
diff options
context:
space:
mode:
authorAbhijeet Kasurde <akasurde@redhat.com>2024-10-18 19:53:11 +0200
committerGitHub <noreply@github.com>2024-10-18 19:53:11 +0200
commit53ceb74e840ea790256601addb610233d878d83e (patch)
treea3e6fa4a6f60661bef1f3a5eada1a4e7005d6723 /test/integration/targets/service
parentTrim `selinux_policytype` @ integration tests (#84136) (diff)
downloadansible-53ceb74e840ea790256601addb610233d878d83e.tar.xz
ansible-53ceb74e840ea790256601addb610233d878d83e.zip
Use open with context manager (#83337)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Diffstat (limited to 'test/integration/targets/service')
-rw-r--r--test/integration/targets/service/files/ansible_test_service.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/test/integration/targets/service/files/ansible_test_service.py b/test/integration/targets/service/files/ansible_test_service.py
index 6bf404cad4..9104572cb7 100644
--- a/test/integration/targets/service/files/ansible_test_service.py
+++ b/test/integration/targets/service/files/ansible_test_service.py
@@ -38,9 +38,8 @@ def createDaemon():
os.chdir(WORKDIR)
os.umask(UMASK)
else:
- f = open('/var/run/ansible_test_service.pid', 'w')
- f.write("%d\n" % pid)
- f.close()
+ with open('/var/run/ansible_test_service.pid', 'w') as f:
+ f.write("%d\n" % pid)
os._exit(0)
else:
os._exit(0)