From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EC85DEB64DD for ; Mon, 3 Jul 2023 13:35:41 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A75A985BBE; Mon, 3 Jul 2023 15:35:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="JJCeA7ti"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 834C384768; Mon, 3 Jul 2023 15:35:33 +0200 (CEST) Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2375485EDD for ; Mon, 3 Jul 2023 15:35:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jpewhacker@gmail.com Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-3a3ad1f39ebso588224b6e.1 for ; Mon, 03 Jul 2023 06:35:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688391325; x=1690983325; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=7C5CIL2gozXX65KfvHmDfybdIdYijWTFlLlk3WaxVgg=; b=JJCeA7tiIAOKdNGojtbrP9mE9jCV3wJwXpIM3Au1x+q9fr939LpLWBvkxyGnIRXplQ 6Ei3sSiCh7dm/uNlJc6D38ZBXfTpi/H0BzC2On6q0ZMk/JCxIicymCQbR/TCfluiEHd5 KgRja/Cw5N76r5CFdi0AWxq3X7/3J+S8Syw+gvjcMnC+mYRsnJBWKD9cjpj4K4XmvKc8 67y4a8ZRCIE9Yw3DPIHd9AcHvZXj3k62HcBWZpIeiJn2JGUi6V2t4sAo1H1gyah5Ly8L TTNYWsU9epIhvZjJ6+jpqmoj/3nmTPRPoXkcb1xW7ivdT85SIjI5tqSvlwLte/eJGz36 kN4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688391325; x=1690983325; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7C5CIL2gozXX65KfvHmDfybdIdYijWTFlLlk3WaxVgg=; b=AA9vTi3D0pUc7MRqvTlHXu56majlvSh3uU22suWhILo9d8D8bvtQXdOstzBkW9coAj MtAqpdIQcxGm+z4PetB4eZYBrCAQlHxF3vTfon9b2DHagNq94WQReYdxMG3k19j4r9eE 1cdtc46hw7tmzNsbpv59iJcJzGTEniLoV+bytPnoX/zOh8b33QChxOrvZEiIdbrJ7hlV rO2PiwfeV884BssveqqNQFGwkTx8pAqvm6BMfVHObmG72g9dM4b+elk2/+yJd3DR+Fli jYM0SE5IMczdYKwpa7vXfKTmKvTYVqHmlkitfRPWdD1sL/HDXF8eSp56tdj15ZbyRr3o gWWA== X-Gm-Message-State: AC+VfDxBMAzBimsnwhsSwQedCI2N2agGlRSpoug5+f+vJvsN1rxzrG73 wsi4POnTJQ2hHtKvagQrdaXsOnkFY7A= X-Google-Smtp-Source: ACHHUZ7TziaX3nggFiaTzD+d5ie/8c0rGS/QVlQkDyJWpDMBBvXTZgxPKQ306a4v0Aptf1e6yeZ3yQ== X-Received: by 2002:a05:6808:1a88:b0:398:282d:27cb with SMTP id bm8-20020a0568081a8800b00398282d27cbmr4555635oib.27.1688391324765; Mon, 03 Jul 2023 06:35:24 -0700 (PDT) Received: from localhost.localdomain ([204.77.163.107]) by smtp.gmail.com with ESMTPSA id a12-20020a056808128c00b003a371c611f6sm3775920oiw.18.2023.07.03.06.35.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jul 2023 06:35:24 -0700 (PDT) From: Joshua Watt X-Google-Original-From: Joshua Watt To: u-boot@lists.denx.de Cc: Joshua Watt , Roger Knecht , Simon Glass Subject: [PATCH] tests: Fix exception when cleaning up skipped test Date: Mon, 3 Jul 2023 08:35:09 -0500 Message-Id: <20230703133518.3879199-1-JPEWhacker@gmail.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean 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 --- 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