From eec673b5c0122e359bf00b0136783a32e8a77df9 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 29 Sep 2026 23:44:16 +0500 Subject: test: rework using the approach from my other projects The tests are now run using a framework common to my other projects, like config-links & tag-release. --- test/lib/test.sh | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) mode change 100755 => 100644 test/lib/test.sh (limited to 'test/lib/test.sh') diff --git a/test/lib/test.sh b/test/lib/test.sh old mode 100755 new mode 100644 index 56b3235..30c4ce1 --- a/test/lib/test.sh +++ b/test/lib/test.sh @@ -1,27 +1,25 @@ -#!/usr/bin/env bash - # Copyright (c) 2020 Egor Tensin # This file is part of the "VK scripts" project. # For details, see https://github.com/egor-tensin/vk-scripts # Distributed under the MIT License. -set -o errexit -o nounset -o pipefail +test_should_fail= +test_root_dir= -script_dir="$( dirname -- "${BASH_SOURCE[0]}" )" -script_dir="$( cd -- "$script_dir" && pwd )" -readonly script_dir +test_setup() { + test_root_dir="$( mktemp -d )" -run_test() { - local arg - echo - echo ====================================================================== - for arg; do - echo -n "$arg " - done - echo - echo ====================================================================== + log "Root directory: $test_root_dir" +} - PYTHONPATH="$script_dir/../.." python -m "$@" +test_cleanup_default() { + if [ -n "$test_root_dir" ]; then + log "Removing test's root directory: $test_root_dir" + rm -rf -- "$test_root_dir" + fi } -run_test "$@" +test_run_module() { + log_run python -m "$@" + PYTHONPATH="$script_dir/.." python -m "$@" +} -- cgit v1.3