Commit 1f83ae08 authored by Vojtěch Horký's avatar Vojtěch Horký
Browse files

11/tapsum2json: various fixes

parent 8151025b
......@@ -4,6 +4,18 @@
load "../../nswi177"
get_install_requires() {
python3 -c 'import configparser
cfg = configparser.ConfigParser()
cfg.read_file(open("11/tapsum2json/setup.cfg"))
print(cfg.get("options", "install_requires").strip())' \
2>/dev/null
}
get_bare_library_names() {
sed -e 's#\([^~<>=]*\).*#\1#'
}
make_venv_activate_and_install() {
local venv_path="$1"
......@@ -12,12 +24,21 @@ make_venv_activate_and_install() {
python3 -m venv "$venv_path"
. "$venv_path/bin/activate"
launch python -m pip install --upgrade pip
if [ -d /srv/nswi177/pypi/cache/ ] && [ -d /srv/nswi177/pypi/downloads/ ]; then
launch python -m pip download --no-deps --cache-dir /srv/nswi177/pypi/cache/ --find-links /srv/nswi177/pypi/downloads/ pip==22.1
launch python -m pip install --cache-dir /srv/nswi177/pypi/cache/ --find-links /srv/nswi177/pypi/downloads/ pip==22.1
else
launch python -m pip install --upgrade pip
fi
assert_status 0 \
"stdout" "${output}" \
"stderr" "${erroroutput}"
launch python -m pip install -e .
if [ -d /srv/nswi177/pypi/cache/ ] && [ -d /srv/nswi177/pypi/downloads/ ]; then
launch python -m pip install --cache-dir /srv/nswi177/pypi/cache/ --find-links /srv/nswi177/pypi/downloads/ -e .
else
launch python -m pip install -e .
fi
assert_status 0 \
"stdout" "${output}" \
"stderr" "${erroroutput}"
......@@ -78,6 +99,8 @@ run_it() {
@test "11/tapsum2json/setup.cfg - Only reasonable files are committed (10)" {
only_on_gitlab
skip_if_missing
launch find 11/tapsum2json/ -name 'pyvenv.cfg'
if [ -n "$output" ]; then
output="$( dirname "$( echo "$output" | head -n 1 )" )"
......@@ -97,12 +120,16 @@ run_it() {
@test "11/tapsum2json/setup.cfg - No input files (10)" {
skip_if_missing
run_it 'no-input' '{
"summary": []
}'
}
@test "11/tapsum2json/setup.cfg - Single file, both tests passing (10)" {
skip_if_missing
run_it 'single-file' '{
"summary": [
{
......@@ -117,6 +144,8 @@ run_it() {
}
@test "11/tapsum2json/setup.cfg - Single non-existent file (10)" {
skip_if_missing
run_it 'single-nonexisting' '{
"summary": [
{
......@@ -132,6 +161,8 @@ run_it() {
}
@test "11/tapsum2json/setup.cfg - Single file with skipped tests (10)" {
skip_if_missing
run_it 'skipped-tests' '{
"summary": [
{
......@@ -148,6 +179,8 @@ run_it() {
@test "11/tapsum2json/setup.cfg - Single file with another skipped tests (10)" {
skip_if_missing
run_it 'skipped-tests-2' '{
"summary": [
{
......@@ -163,6 +196,8 @@ run_it() {
}
@test "11/tapsum2json/setup.cfg - Pipeline-like invocation (10)" {
skip_if_missing
run_it 'pipeline' '{
"summary": [
{
......@@ -194,6 +229,8 @@ run_it() {
@test "11/tapsum2json/setup.cfg - Filename with space (10)" {
skip_if_missing
run_it 'filename-with-spaces' '{
"summary": [
{
......@@ -209,6 +246,8 @@ run_it() {
}
@test "11/tapsum2json/setup.cfg - Filename with quote character (10)" {
skip_if_missing
run_it 'filename-with-quote' '{
"summary": [
{
......@@ -225,6 +264,8 @@ run_it() {
@test "11/tapsum2json/setup.cfg - Test with bail out (10)" {
skip_if_missing
run_it 'bail-out' '{
"summary": [
{
......@@ -238,3 +279,19 @@ run_it() {
}' "${NSWI177_TEST_ROOT:?}/data/11/bailout.tap"
}
@test "11/tapsum2json/requirements.txt - Needless dependencies (-2)" {
skip_if_missing
output="$( get_bare_library_names <11/tapsum2json/requirements.txt | grep -v -e 'pkg_resources' -e 'jsons' -e 'setuptools' || true )"
strip_output_whitespace
msg="Expected only tap.py among dependencies" assert_output_equals "tap.py"
}
@test "11/tapsum2json/setup.cfg - Needless dependencies (-2)" {
skip_if_missing
output="$( get_install_requires | get_bare_library_names )"
strip_output_whitespace
msg="Expected only tap.py among dependencies" assert_output_equals "tap.py"
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment