summaryrefslogtreecommitdiffstatshomepage
path: root/test/lib/test.sh
blob: 4b435629f21e099307c6c1585a1335162eb1b022 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Copyright (c) 2020 Egor Tensin <egor@tensin.name>
# This file is part of the "VK scripts" project.
# For details, see https://github.com/egor-tensin/vk-scripts
# Distributed under the MIT License.

test_should_fail=
test_root_dir=

test_setup() {
    test_root_dir="$( mktemp -d )"

    log "Root directory: $test_root_dir"
}

test_cleanup_default() {
    if [ -n "$test_root_dir" ]; then
        log "Removing test's root directory: $test_root_dir"
        rm -rf -- "$test_root_dir"
    fi
}

test_run_module() {
    local cmd=(python3 -m "$@")
    log_run "${cmd[@]}"
    PYTHONPATH="$script_dir/.." "${cmd[@]}"
}