diff options
author | Joshua Watt <jpewhacker@gmail.com> | 2023-07-03 08:35:09 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-07-17 15:39:55 -0400 |
commit | 8900ba1ad7cbe5ad143c39635e93f7c3b1d41460 (patch) | |
tree | 202341498cd6d9d04fcef6ee3729d1d54e9c344c /test/py | |
parent | 22cdb3f0f174e926071975cdc5157aa6526b67a7 (diff) |
tests: Fix exception when cleaning up skipped test
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>
Diffstat (limited to 'test/py')
-rw-r--r-- | test/py/tests/test_cat/conftest.py | 3 | ||||
-rw-r--r-- | 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 fc396f50d32..320e7ebd295 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 f35b8f11136..47c7cce1aa9 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) |