diff mbox series

[04/22] tests/functional: remove pointless with statement

Message ID 20241129173120.761728-5-berrange@redhat.com (mailing list archive)
State New
Headers show
Series tests/functional: various improvements wrt assets/scratch files | expand

Commit Message

Daniel P. Berrangé Nov. 29, 2024, 5:31 p.m. UTC
The xorriso command directly writes to 'filename', so the surrounding
'with' statement is pointless.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 tests/functional/test_ppc64_hv.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Thomas Huth Nov. 30, 2024, 10:10 a.m. UTC | #1
On 29/11/2024 18.31, Daniel P. Berrangé wrote:
> The xorriso command directly writes to 'filename', so the surrounding
> 'with' statement is pointless.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>   tests/functional/test_ppc64_hv.py | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/functional/test_ppc64_hv.py b/tests/functional/test_ppc64_hv.py
> index c31432d18d..53bae90401 100755
> --- a/tests/functional/test_ppc64_hv.py
> +++ b/tests/functional/test_ppc64_hv.py
> @@ -72,10 +72,9 @@ def extract_from_iso(self, iso, path):
>           cwd = os.getcwd()
>           os.chdir(self.workdir)
>   
> -        with open(filename, "w") as outfile:
> -            cmd = "xorriso -osirrox on -indev %s -cpx %s %s" % (iso, path, filename)
> -            subprocess.run(cmd.split(),
> -                           stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
> +        cmd = "xorriso -osirrox on -indev %s -cpx %s %s" % (iso, path, filename)
> +        subprocess.run(cmd.split(),
> +                       stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
>   
>           os.chmod(filename, 0o600)
>           os.chdir(cwd)

Reviewed-by: Thomas Huth <thuth@redhat.com>
diff mbox series

Patch

diff --git a/tests/functional/test_ppc64_hv.py b/tests/functional/test_ppc64_hv.py
index c31432d18d..53bae90401 100755
--- a/tests/functional/test_ppc64_hv.py
+++ b/tests/functional/test_ppc64_hv.py
@@ -72,10 +72,9 @@  def extract_from_iso(self, iso, path):
         cwd = os.getcwd()
         os.chdir(self.workdir)
 
-        with open(filename, "w") as outfile:
-            cmd = "xorriso -osirrox on -indev %s -cpx %s %s" % (iso, path, filename)
-            subprocess.run(cmd.split(),
-                           stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+        cmd = "xorriso -osirrox on -indev %s -cpx %s %s" % (iso, path, filename)
+        subprocess.run(cmd.split(),
+                       stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
 
         os.chmod(filename, 0o600)
         os.chdir(cwd)