Skip to content

Commit e87957d

Browse files
committed
Fix unclosed files in standalone tests
1 parent 5a2a898 commit e87957d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

graalpython/com.oracle.graal.python.test/src/tests/standalone/test_gradle_plugin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ def check_gradle_generated_app(self):
130130

131131
# import struct from python file triggers extract of native extension files in VirtualFileSystem
132132
hello_src = os.path.join(target_dir, "src", "main", "resources", "org.graalvm.python.vfs", "src", "hello.py")
133-
contents = open(hello_src, 'r').read()
133+
with open(hello_src) as f:
134+
contents = f.read()
134135
with open(hello_src, 'w') as f:
135136
f.write("import struct\n" + contents)
136137

graalpython/com.oracle.graal.python.test/src/tests/standalone/test_maven_plugin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ def test_generated_app(self):
111111

112112
# import struct from python file triggers extract of native extension files in VirtualFileSystem
113113
hello_src = os.path.join(target_dir, "src", "main", "resources", "org.graalvm.python.vfs", "src", "hello.py")
114-
contents = open(hello_src, 'r').read()
114+
with open(hello_src) as f:
115+
contents = f.read()
115116
with open(hello_src, 'w') as f:
116117
f.write("import struct\n" + contents)
117118

0 commit comments

Comments
 (0)