mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jonas Rebmann <jre@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
	 BAREBOX <barebox@lists.infradead.org>
Cc: Jonas Rebmann <jre@pengutronix.de>
Subject: [PATCH 2/7] test: provide testfs via fixture
Date: Fri, 26 Sep 2025 12:14:03 +0200	[thread overview]
Message-ID: <20250926-tlv-integration-v1-2-45dc68b9b602@pengutronix.de> (raw)
In-Reply-To: <20250926-tlv-integration-v1-0-45dc68b9b602@pengutronix.de>

Move the logic of providing testfs out of the tests and into a fixture.
Pytest-modules that prepare testing data in their own fixtures should
build on top of this.

Tests using the fixture will be skipped if the feature is unavailable;
remove that check from existing tests.

Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
---
 conftest.py         | 8 ++++++++
 test/py/test_fit.py | 5 +----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/conftest.py b/conftest.py
index 00969e62df..116beb5d14 100644
--- a/conftest.py
+++ b/conftest.py
@@ -231,3 +231,11 @@ def strategy(request, target, pytestconfig):
         strategy.force(state)
 
     return strategy
+
+@pytest.fixture(scope="session")
+def testfs(strategy, env):
+    if "testfs" not in env.get_target_features():
+        pytest.skip("testfs not supported on this platform")
+
+    path = os.path.join(os.environ["LG_BUILDDIR"], "testfs")
+    return path
diff --git a/test/py/test_fit.py b/test/py/test_fit.py
index 08d5feba5c..3b2b8ff871 100644
--- a/test/py/test_fit.py
+++ b/test/py/test_fit.py
@@ -15,10 +15,7 @@ def generate_bootscript(barebox, image, name="test"):
     return name
 
 
-def test_fit(barebox, env, target, barebox_config):
-    if 'testfs' not in env.get_target_features():
-        pytest.xfail("testfs feature not specified")
-
+def test_fit(barebox, env, target, barebox_config, testfs):
     _, _, returncode = barebox.run(f"ls {fit_name('gzipped')}")
     if returncode != 0:
         pytest.xfail("skipping test due to missing FIT image")

-- 
2.51.0.297.gca2559c1d6




  parent reply	other threads:[~2025-09-26 10:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-26 10:14 [PATCH 0/7] TLV integration tests and test/py cleanup Jonas Rebmann
2025-09-26 10:14 ` [PATCH 1/7] test: when testfs feature is available, always enable it Jonas Rebmann
2025-09-26 10:14 ` Jonas Rebmann [this message]
2025-09-26 10:14 ` [PATCH 3/7] test: move dm-verity testdata generation to fixture Jonas Rebmann
2025-09-26 14:25   ` Jonas Rebmann
2025-09-28  9:54     ` Tobias Waldekranz
2025-09-29  8:29       ` Jonas Rebmann
2025-09-29  7:53     ` Sascha Hauer
2025-09-26 10:14 ` [PATCH 4/7] test: py: test_bootchooser: remove dead code Jonas Rebmann
2025-09-26 10:14 ` [PATCH 5/7] commands: tlv: clarify error opening tlv Jonas Rebmann
2025-09-26 10:14 ` [PATCH 6/7] ci: container: install crcmod and cryptography Jonas Rebmann
2025-09-26 10:14 ` [PATCH 7/7] test: py: add TLV integration tests Jonas Rebmann
2025-09-26 13:57 ` [PATCH 0/7] TLV integration tests and test/py cleanup Jonas Rebmann

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=20250926-tlv-integration-v1-2-45dc68b9b602@pengutronix.de \
    --to=jre@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.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