From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Jonas Rebmann <jre@pengutronix.de>,
Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH v2] fixup! test: py: add TLV integration tests
Date: Wed, 15 Oct 2025 11:26:01 +0200 [thread overview]
Message-ID: <20251015092602.2354751-1-a.fatoum@pengutronix.de> (raw)
test: py: tlv: skip tests if crcmod is missing
We document nowhere that crcmod is a required dependency for the test
suite. Skip the tests requiring it if it's not installed.
In the future, it's probably worthwhile to add some requirements.txt or
similar that uv could use to set up a python environment with all the
dependencies?
Cc: Jonas Rebmann <jre@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- do not touch the generator and do the skipping in the test itself to
allow for easier backporting (Jonas)
---
test/py/test_tlv.py | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/test/py/test_tlv.py b/test/py/test_tlv.py
index 963f3749b33b..c1bb9a17b4a8 100644
--- a/test/py/test_tlv.py
+++ b/test/py/test_tlv.py
@@ -1,14 +1,17 @@
+import sys
import os
import re
import subprocess
from pathlib import Path
-from crcmod.predefined import mkPredefinedCrcFun
from .helper import skip_disabled
-
-_crc32_mpeg = mkPredefinedCrcFun("crc-32-mpeg")
-
import pytest
+try:
+ from crcmod.predefined import mkPredefinedCrcFun
+ _crc32_mpeg = mkPredefinedCrcFun("crc-32-mpeg")
+except ModuleNotFoundError:
+ _crc32_mpeg = None
+
class _TLV_Testdata:
def generator(self, args, check=True):
@@ -29,6 +32,9 @@ class _TLV_Testdata:
@pytest.fixture(scope="module")
def tlv_testdata(testfs):
+ if _crc32_mpeg is None:
+ pytest.skip("missing crcmod dependency")
+
t = _TLV_Testdata(testfs)
t.generator(["--input-data", str(t.data), str(t.schema), str(t.unsigned_bin)])
assert t.unsigned_bin.exists(), "unsigned TLV not created"
--
2.47.3
next reply other threads:[~2025-10-15 9:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-15 9:26 Ahmad Fatoum [this message]
2025-10-20 10:48 ` Sascha Hauer
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=20251015092602.2354751-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=jre@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