tests: fix ResourceWarning: unclosed file when running osbuild
We don't close osbuild's stdin when no input is given. Don't open stdin at all when no input is specified.
This commit is contained in:
parent
2457635bac
commit
dff8d6591b
1 changed files with 3 additions and 1 deletions
|
|
@ -40,7 +40,9 @@ class TestCase(unittest.TestCase):
|
|||
osbuild_cmd.append("--build-pipeline")
|
||||
osbuild_cmd.append(build_pipeline)
|
||||
|
||||
p = subprocess.Popen(osbuild_cmd, encoding="utf-8", stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
stdin = subprocess.PIPE if input else None
|
||||
|
||||
p = subprocess.Popen(osbuild_cmd, encoding="utf-8", stdin=stdin, stdout=subprocess.PIPE)
|
||||
if input:
|
||||
p.stdin.write(input)
|
||||
p.stdin.close()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue