* [PATCH] tests: Fix exception when cleaning up skipped test
@ 2023-07-03 13:35 Joshua Watt
2023-07-04 2:40 ` Simon Glass
2023-07-18 13:58 ` Tom Rini
0 siblings, 2 replies; 3+ messages in thread
From: Joshua Watt @ 2023-07-03 13:35 UTC (permalink / raw)
To: u-boot; +Cc: Joshua Watt, Roger Knecht, Simon Glass
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tests: Fix exception when cleaning up skipped test
2023-07-03 13:35 [PATCH] tests: Fix exception when cleaning up skipped test Joshua Watt
@ 2023-07-04 2:40 ` Simon Glass
2023-07-18 13:58 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2023-07-04 2:40 UTC (permalink / raw)
To: Joshua Watt; +Cc: u-boot, Roger Knecht
On Mon, 3 Jul 2023 at 14:35, Joshua Watt <jpewhacker@gmail.com> wrote:
>
> 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(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tests: Fix exception when cleaning up skipped test
2023-07-03 13:35 [PATCH] tests: Fix exception when cleaning up skipped test Joshua Watt
2023-07-04 2:40 ` Simon Glass
@ 2023-07-18 13:58 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2023-07-18 13:58 UTC (permalink / raw)
To: Joshua Watt; +Cc: u-boot, Roger Knecht, Simon Glass
[-- Attachment #1: Type: text/plain, Size: 497 bytes --]
On Mon, Jul 03, 2023 at 08:35:09AM -0500, Joshua Watt wrote:
> 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>
> Reviewed-by: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-18 13:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-03 13:35 [PATCH] tests: Fix exception when cleaning up skipped test Joshua Watt
2023-07-04 2:40 ` Simon Glass
2023-07-18 13:58 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox