]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
python3-cryptography: use python3-unittest-automake-output
authorRoss Burton <ross.burton@arm.com>
Tue, 21 Mar 2023 12:37:35 +0000 (12:37 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 21 Mar 2023 22:40:45 +0000 (22:40 +0000)
Instead of using sed to reformat the output use this new module.

This shows that the previous sed expression wasn't sufficient because it
didn't handle tests throwing an error, and now the bench/ tests fail
because we don't have pytest-benchmark.  These tests are more of a
benchmark than a unit test, so just skip them.

Also show a skip message instead of nothing if the tests were skipped
due to a lack of memory.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-devtools/python/python3-cryptography/check-memfree.py
meta/recipes-devtools/python/python3-cryptography/run-ptest
meta/recipes-devtools/python/python3-cryptography_39.0.2.bb

index c111a9074c1582a37793bbccfc49c4a2d2384f6d..ed680d8d5b99671a08cee5f6d21ee9ae0cc7407d 100755 (executable)
@@ -4,7 +4,7 @@ import sys
 meminfo = dict((i.split()[0].rstrip(':'),int(i.split()[1])) for i in open('/proc/meminfo').readlines())
 mem_free = meminfo['MemTotal']/1024./1024.
 if mem_free < 2.:
-    raise RuntimeError("Insufficient free memory({:.3f}): requires > 2 GB".format(mem_free))
+    print("Insufficient free memory({:.3f}): requires > 2 GB".format(mem_free))
     sys.exit(1)
 else:
     print("Free memory: {:.3f} GB".format(mem_free))
index 3089df878197a2273887c5b4993874b8e73383ad..fe191a5dc44130da0d95b4cf7ba68955eafbb522 100644 (file)
@@ -1,4 +1,9 @@
 #!/bin/sh
+
 if ./check-memfree.py; then
-    pytest -vvvv tests/ -o log_cli=true -o log_cli_level=INFO | sed -e 's/\[...%\]//g'| sed -e 's/PASSED/PASS/g'| sed -e 's/FAILED/FAIL/g'|sed -e 's/SKIPPED/SKIP/g'| awk '{if ($NF=="PASS" || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || $NF=="XPASS"){printf "%s: %s\n", $NF, $0}else{print}}'| awk '{if ($NF=="PASS" || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || $NF=="XPASS") {$NF="";print $0}else{print}}'
+    # Skip the bench test module, we don't yet have pytest3-benchmark in core
+    # and these are more benchmarks than unit tests.
+    pytest --automake -k 'not bench'
+else
+    echo "SKIP: crytography.not_enough_memory"
 fi
index 4b591bc59bf0d916531e17821b62f360fa58dd9e..449e3ba1bcc1e1e38baa5a2be4162f2b448034b1 100644 (file)
@@ -43,6 +43,7 @@ RDEPENDS:${PN}-ptest += " \
     ${PYTHON_PN}-pretend \
     ${PYTHON_PN}-psutil \
     ${PYTHON_PN}-pytest \
+    ${PYTHON_PN}-unittest-automake-output \
     ${PYTHON_PN}-pytest-subtests \
     ${PYTHON_PN}-pytz \
 "