Skip to content

Commit 1fee129

Browse files
committed
Properly close files used for testing
1 parent 55bd91a commit 1fee129

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

test/test_before_build.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ def test(tmp_path):
4141
project_with_before_build_asserts.generate(project_dir)
4242

4343
before_build = (
44-
"""python -c "import sys; open('{project}/pythonversion_bb.txt', 'w').write(sys.version)" && """
45-
f'''python -c "import sys; open('{{project}}/pythonprefix_bb.txt', 'w').write({SYS_PREFIX})"'''
44+
"""python -c "import sys; f = open('{project}/pythonversion_bb.txt', 'w'); f.write(sys.version); f.close()" && """
45+
f'''python -c "import sys; f = open('{{project}}/pythonprefix_bb.txt', 'w'); f.write({SYS_PREFIX}); f.close()"'''
4646
)
4747
frontend = "build"
4848
if utils.platform != "pyodide":

test/test_before_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ def test(tmp_path, build_frontend_env):
3939
test_projects.new_c_project().generate(test_project_dir)
4040

4141
before_test_steps = [
42-
'''python -c "import os, sys; open('{project}/pythonversion_bt.txt', 'w').write(sys.version)"''',
43-
'''python -c "import os, sys; open('{project}/pythonprefix_bt.txt', 'w').write(sys.prefix)"''',
42+
'''python -c "import os, sys; f = open('{project}/pythonversion_bt.txt', 'w'); f.write(sys.version); f.close()"''',
43+
'''python -c "import os, sys; f = open('{project}/pythonprefix_bt.txt', 'w'); f.write(sys.prefix); f.close()"''',
4444
]
4545

4646
if utils.platform == "pyodide":

0 commit comments

Comments
 (0)