meta-openembedded/meta-python/recipes-devtools/python/python3-betamax/run-ptest
Gyorgy Sarvari b476f98381 python3-betamax: fix ptests
1. Some tests require internet access. Set a DNS for that, if it is not
available at the start of the test.

2. Added a backported patch that fixes some failing tests, due to a
variable header value contained in a response. (fix-failing-ptest.patch)

3. Added a backported patch that avoids calling pytest fixtures directly.
If not applied, tests calling them are marked as failing by pytest.
(fix-direct-calls-to-test-fixtures.patch)

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
2025-10-20 11:59:36 +02:00

611 B

#!/bin/sh

if ! nslookup httpbin.org >/dev/null 2>&1 ; then trap 'mv /etc/resolv.conf.bak /etc/resolv.conf' INT EXIT mv /etc/resolv.conf /etc/resolv.conf.bak echo "nameserver 8.8.8.8" > /etc/resolv.conf fi

pytest -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}}'