From: Joshua Watt <jpewhacker@gmail.com>
To: u-boot@lists.denx.de
Cc: Joshua Watt <JPEWhacker@gmail.com>, Roger Knecht <rknecht@pm.me>,
Simon Glass <sjg@chromium.org>
Subject: [PATCH] tests: Fix exception when cleaning up skipped test
Date: Mon, 3 Jul 2023 08:35:09 -0500 [thread overview]
Message-ID: <20230703133518.3879199-1-JPEWhacker@gmail.com> (raw)
If test_cat and test_xxd cannot create the required file, the test will
be skipped, but this would result in an exception being raised in the
finally block because the file didn't exist to be cleaned up. This
caused the test to be marked as failed instead of skipped.
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
test/py/tests/test_cat/conftest.py | 3 ++-
test/py/tests/test_xxd/conftest.py | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/test/py/tests/test_cat/conftest.py b/test/py/tests/test_cat/conftest.py
index 058fe52352..ef1c54d513 100644
--- a/test/py/tests/test_cat/conftest.py
+++ b/test/py/tests/test_cat/conftest.py
@@ -32,4 +32,5 @@ def cat_data(u_boot_config):
pytest.skip('Setup failed')
finally:
shutil.rmtree(mnt_point)
- os.remove(image_path)
+ if os.path.exists(image_path):
+ os.remove(image_path)
diff --git a/test/py/tests/test_xxd/conftest.py b/test/py/tests/test_xxd/conftest.py
index 59285aadf4..481a794961 100644
--- a/test/py/tests/test_xxd/conftest.py
+++ b/test/py/tests/test_xxd/conftest.py
@@ -32,4 +32,5 @@ def xxd_data(u_boot_config):
pytest.skip('Setup failed')
finally:
shutil.rmtree(mnt_point)
- os.remove(image_path)
+ if os.path.exists(image_path):
+ os.remove(image_path)
--
2.33.0
next reply other threads:[~2023-07-03 13:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-03 13:35 Joshua Watt [this message]
2023-07-04 2:40 ` [PATCH] tests: Fix exception when cleaning up skipped test Simon Glass
2023-07-18 13:58 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230703133518.3879199-1-JPEWhacker@gmail.com \
--to=jpewhacker@gmail.com \
--cc=rknecht@pm.me \
--cc=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox