* [PATCH v2] fixup! test: py: add TLV integration tests
@ 2025-10-15 9:26 Ahmad Fatoum
2025-10-20 10:48 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2025-10-15 9:26 UTC (permalink / raw)
To: barebox; +Cc: Jonas Rebmann, Ahmad Fatoum
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] fixup! test: py: add TLV integration tests
2025-10-15 9:26 [PATCH v2] fixup! test: py: add TLV integration tests Ahmad Fatoum
@ 2025-10-20 10:48 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-10-20 10:48 UTC (permalink / raw)
To: barebox, Ahmad Fatoum; +Cc: Jonas Rebmann
On Wed, 15 Oct 2025 11:26:01 +0200, Ahmad Fatoum wrote:
> 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?
>
> [...]
Applied, thanks!
[1/1] fixup! test: py: add TLV integration tests
https://git.pengutronix.de/cgit/barebox/commit/?id=f33e9c3db94b (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-20 12:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-15 9:26 [PATCH v2] fixup! test: py: add TLV integration tests Ahmad Fatoum
2025-10-20 10:48 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox