vk-scripts 1.1__tar.gz → 1.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {vk_scripts-1.1 → vk_scripts-1.2.0}/.git-blame-ignore-revs +1 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/.github/workflows/ci.yml +4 -4
- {vk_scripts-1.1/vk_scripts.egg-info → vk_scripts-1.2.0}/PKG-INFO +1 -1
- vk_scripts-1.2.0/test/lib/log.sh +139 -0
- vk_scripts-1.2.0/test/lib/test.sh +25 -0
- vk_scripts-1.2.0/test/main.sh +77 -0
- vk_scripts-1.2.0/test/tst-mutuals.sh +38 -0
- vk_scripts-1.2.0/test/tst-sessions.sh +51 -0
- vk_scripts-1.2.0/test/tst-status-once.sh +25 -0
- vk_scripts-1.2.0/test/tst-status.sh +45 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk/api.py +2 -2
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk/error.py +1 -1
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk/last_seen.py +1 -1
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk/mutuals.py +1 -1
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk/platform.py +1 -1
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk/tracking/db/__init__.py +1 -1
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk/tracking/db/backend/__init__.py +1 -1
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk/tracking/db/backend/csv.py +1 -1
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk/tracking/db/backend/log.py +1 -1
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk/tracking/db/backend/null.py +1 -1
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk/tracking/db/format.py +1 -1
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk/tracking/db/meta.py +1 -1
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk/tracking/db/record.py +1 -1
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk/tracking/db/timestamp.py +1 -1
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk/tracking/sessions.py +1 -1
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk/tracking/status.py +1 -1
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk/user.py +1 -1
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk/utils/bar_chart.py +1 -1
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk/utils/io.py +1 -1
- {vk_scripts-1.1 → vk_scripts-1.2.0/vk_scripts.egg-info}/PKG-INFO +1 -1
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk_scripts.egg-info/SOURCES.txt +7 -6
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk_scripts.egg-info/scm_file_list.json +33 -32
- vk_scripts-1.2.0/vk_scripts.egg-info/scm_version.json +8 -0
- vk_scripts-1.1/test/bin/main.sh +0 -19
- vk_scripts-1.1/test/bin/mutuals.sh +0 -23
- vk_scripts-1.1/test/bin/sessions.sh +0 -69
- vk_scripts-1.1/test/bin/status.sh +0 -60
- vk_scripts-1.1/test/bin/status_once.sh +0 -22
- vk_scripts-1.1/test/lib/test.sh +0 -27
- vk_scripts-1.1/vk_scripts.egg-info/scm_version.json +0 -8
- {vk_scripts-1.1 → vk_scripts-1.2.0}/.gitattributes +0 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/.github/dependabot.yml +0 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/.gitignore +0 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/.pylintrc +0 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/LICENSE.txt +0 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/README.md +0 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/docs/images/date.png +0 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/docs/images/hour.png +0 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/docs/images/user.png +0 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/docs/images/weekday.png +0 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/docs/mutuals.md +0 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/docs/sessions.md +0 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/docs/status.md +0 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/pyproject.toml +0 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/setup.cfg +0 -0
- {vk_scripts-1.1/test/share → vk_scripts-1.2.0/test/data}/test_db.csv +0 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk/__init__.py +0 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk/tracking/__init__.py +0 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk/utils/__init__.py +0 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk/version.py +0 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk_scripts.egg-info/dependency_links.txt +0 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk_scripts.egg-info/entry_points.txt +0 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk_scripts.egg-info/requires.txt +0 -0
- {vk_scripts-1.1 → vk_scripts-1.2.0}/vk_scripts.egg-info/top_level.txt +0 -0
|
@@ -25,7 +25,7 @@ jobs:
|
|
|
25
25
|
with:
|
|
26
26
|
fetch-depth: 0
|
|
27
27
|
- name: Set up Python
|
|
28
|
-
uses: actions/setup-python@
|
|
28
|
+
uses: actions/setup-python@v7
|
|
29
29
|
with:
|
|
30
30
|
python-version: '3.x'
|
|
31
31
|
- name: Run black
|
|
@@ -45,7 +45,7 @@ jobs:
|
|
|
45
45
|
with:
|
|
46
46
|
fetch-depth: 0
|
|
47
47
|
- name: Set up Python
|
|
48
|
-
uses: actions/setup-python@
|
|
48
|
+
uses: actions/setup-python@v7
|
|
49
49
|
with:
|
|
50
50
|
python-version: '${{ matrix.python-version }}'
|
|
51
51
|
- name: 'Install package & dependencies'
|
|
@@ -56,7 +56,7 @@ jobs:
|
|
|
56
56
|
vk-status --version
|
|
57
57
|
vk-sessions --version
|
|
58
58
|
- name: Run tests
|
|
59
|
-
run: ./test/
|
|
59
|
+
run: ./test/main.sh
|
|
60
60
|
|
|
61
61
|
publish_pypi:
|
|
62
62
|
needs: [lint, test]
|
|
@@ -68,7 +68,7 @@ jobs:
|
|
|
68
68
|
with:
|
|
69
69
|
fetch-depth: 0
|
|
70
70
|
- name: Set up Python
|
|
71
|
-
uses: actions/setup-python@
|
|
71
|
+
uses: actions/setup-python@v7
|
|
72
72
|
with:
|
|
73
73
|
python-version: '3.x'
|
|
74
74
|
- name: Verify package can be installed
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Copyright (c) 2026 Egor Tensin <egor@tensin.name>
|
|
2
|
+
# This file is part of the "VK scripts" project.
|
|
3
|
+
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
4
|
+
# Distributed under the MIT License.
|
|
5
|
+
|
|
6
|
+
log() {
|
|
7
|
+
local msg
|
|
8
|
+
for msg; do
|
|
9
|
+
echo -e "$test_file | $msg" >&2
|
|
10
|
+
done
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
log_run() {
|
|
14
|
+
if [ "$#" -lt 1 ]; then
|
|
15
|
+
log "usage: ${FUNCNAME[0]} ARGV0 [ARG...]"
|
|
16
|
+
return 1
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
local msg='Running:'
|
|
20
|
+
msg="$msg$( printf -- ' %q' "$@" )"
|
|
21
|
+
log "$msg"
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
fail() {
|
|
25
|
+
local msg
|
|
26
|
+
for msg; do
|
|
27
|
+
log "FAIL: $msg"
|
|
28
|
+
done
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
fail_details() {
|
|
32
|
+
local msg
|
|
33
|
+
for msg; do
|
|
34
|
+
fail " $msg"
|
|
35
|
+
done
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
log_numof_tests_ok=0
|
|
39
|
+
log_numof_tests_failed=0
|
|
40
|
+
declare -a log_tests_failed=()
|
|
41
|
+
declare -A log_tests_should_fail=()
|
|
42
|
+
|
|
43
|
+
log_test_start() {
|
|
44
|
+
if [ "$#" -ne 1 ]; then
|
|
45
|
+
echo "usage: ${FUNCNAME[0]} TEST_FILE" >&2
|
|
46
|
+
return 1
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
local test_file="$1"
|
|
50
|
+
|
|
51
|
+
if [ -n "${test_should_fail:-}" ]; then
|
|
52
|
+
log_tests_should_fail["$test_file"]=1
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
cat <<EOF >&2
|
|
56
|
+
|
|
57
|
+
======================================================================
|
|
58
|
+
TEST: $test_file
|
|
59
|
+
======================================================================
|
|
60
|
+
EOF
|
|
61
|
+
|
|
62
|
+
log "Should fail: ${test_should_fail:-No}"
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
log_test_ok() {
|
|
66
|
+
if [ "$#" -ne 1 ]; then
|
|
67
|
+
echo "usage: ${FUNCNAME[0]} TEST_FILE" >&2
|
|
68
|
+
return 1
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
log_numof_tests_ok=$((log_numof_tests_ok + 1))
|
|
72
|
+
|
|
73
|
+
cat <<EOF >&2
|
|
74
|
+
----------------------------------------------------------------------
|
|
75
|
+
OK: $1
|
|
76
|
+
----------------------------------------------------------------------
|
|
77
|
+
EOF
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
log_test_fail() {
|
|
81
|
+
if [ "$#" -ne 1 ]; then
|
|
82
|
+
echo "usage: ${FUNCNAME[0]} TEST_FILE" >&2
|
|
83
|
+
return 1
|
|
84
|
+
fi
|
|
85
|
+
|
|
86
|
+
log_numof_tests_failed=$((log_numof_tests_failed + 1))
|
|
87
|
+
log_tests_failed+=("$1")
|
|
88
|
+
|
|
89
|
+
cat <<EOF >&2
|
|
90
|
+
----------------------------------------------------------------------
|
|
91
|
+
FAIL: $1
|
|
92
|
+
----------------------------------------------------------------------
|
|
93
|
+
EOF
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
log_test_finish() {
|
|
97
|
+
if [ "$#" -ne 2 ]; then
|
|
98
|
+
echo "usage: ${FUNCNAME[0]} TEST_FILE EXIT_CODE" >&2
|
|
99
|
+
return 1
|
|
100
|
+
fi
|
|
101
|
+
|
|
102
|
+
local test_file="$1"
|
|
103
|
+
local ret="$2"
|
|
104
|
+
local test_should_fail
|
|
105
|
+
test_should_fail="${log_tests_should_fail["$test_file"]:+x}"
|
|
106
|
+
|
|
107
|
+
if [ "$ret" -eq 0 ] || [ -n "$test_should_fail" ]; then
|
|
108
|
+
log_test_ok "$test_file"
|
|
109
|
+
else
|
|
110
|
+
log_test_fail "$test_file"
|
|
111
|
+
fi
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
log_tests_summary() {
|
|
115
|
+
cat <<EOF >&2
|
|
116
|
+
|
|
117
|
+
======================================================================
|
|
118
|
+
SUMMARY
|
|
119
|
+
======================================================================
|
|
120
|
+
OK: $log_numof_tests_ok
|
|
121
|
+
FAIL: $log_numof_tests_failed
|
|
122
|
+
EOF
|
|
123
|
+
|
|
124
|
+
local test_file
|
|
125
|
+
for test_file in ${log_tests_failed[@]+"${log_tests_failed[@]}"}; do
|
|
126
|
+
cat <<EOF >&2
|
|
127
|
+
FAIL: $test_file
|
|
128
|
+
EOF
|
|
129
|
+
done
|
|
130
|
+
|
|
131
|
+
cat <<EOF >&2
|
|
132
|
+
----------------------------------------------------------------------
|
|
133
|
+
EOF
|
|
134
|
+
|
|
135
|
+
local ret=0
|
|
136
|
+
[ "$log_numof_tests_failed" -gt 0 ] && ret=1
|
|
137
|
+
|
|
138
|
+
return "$ret"
|
|
139
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Copyright (c) 2020 Egor Tensin <egor@tensin.name>
|
|
2
|
+
# This file is part of the "VK scripts" project.
|
|
3
|
+
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
4
|
+
# Distributed under the MIT License.
|
|
5
|
+
|
|
6
|
+
test_should_fail=
|
|
7
|
+
test_root_dir=
|
|
8
|
+
|
|
9
|
+
test_setup() {
|
|
10
|
+
test_root_dir="$( mktemp -d )"
|
|
11
|
+
|
|
12
|
+
log "Root directory: $test_root_dir"
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
test_cleanup_default() {
|
|
16
|
+
if [ -n "$test_root_dir" ]; then
|
|
17
|
+
log "Removing test's root directory: $test_root_dir"
|
|
18
|
+
rm -rf -- "$test_root_dir"
|
|
19
|
+
fi
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
test_run_module() {
|
|
23
|
+
log_run python -m "$@"
|
|
24
|
+
PYTHONPATH="$script_dir/.." python -m "$@"
|
|
25
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# Copyright (c) 2026 Egor Tensin <egor@tensin.name>
|
|
4
|
+
# This file is part of the "VK scripts" project.
|
|
5
|
+
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
6
|
+
# Distributed under the MIT License.
|
|
7
|
+
|
|
8
|
+
set -o errexit -o nounset -o pipefail
|
|
9
|
+
shopt -s inherit_errexit lastpipe
|
|
10
|
+
|
|
11
|
+
script_dir="$( dirname -- "${BASH_SOURCE[0]}" )"
|
|
12
|
+
script_dir="$( cd -- "$script_dir" && pwd )"
|
|
13
|
+
readonly script_dir
|
|
14
|
+
script_name="$( basename -- "${BASH_SOURCE[0]}" )"
|
|
15
|
+
readonly script_name
|
|
16
|
+
|
|
17
|
+
source "$script_dir/lib/log.sh"
|
|
18
|
+
|
|
19
|
+
run_test_file() {
|
|
20
|
+
local test_file
|
|
21
|
+
for test_file; do
|
|
22
|
+
source "$script_dir/lib/test.sh"
|
|
23
|
+
source "$script_dir/$test_file"
|
|
24
|
+
|
|
25
|
+
log_test_start "$test_file"
|
|
26
|
+
|
|
27
|
+
set +e
|
|
28
|
+
(
|
|
29
|
+
set -o errexit -o nounset -o pipefail
|
|
30
|
+
shopt -s inherit_errexit lastpipe
|
|
31
|
+
|
|
32
|
+
if [ "$( type -t test_cleanup )" == function ]; then
|
|
33
|
+
trap test_cleanup EXIT
|
|
34
|
+
else
|
|
35
|
+
trap test_cleanup_default EXIT
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
test_run
|
|
39
|
+
)
|
|
40
|
+
local ret="$?"
|
|
41
|
+
set -e
|
|
42
|
+
|
|
43
|
+
log_test_finish "$test_file" "$ret"
|
|
44
|
+
done
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
main() {
|
|
48
|
+
if [ "$#" -gt 1 ]; then
|
|
49
|
+
echo "usage: $script_name [PATTERN]" >&2
|
|
50
|
+
return 1
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
local -a test_files=()
|
|
54
|
+
local test_file
|
|
55
|
+
|
|
56
|
+
local pattern='*'
|
|
57
|
+
[ "$#" -gt 0 ] && pattern="$1"
|
|
58
|
+
|
|
59
|
+
find "$script_dir" \
|
|
60
|
+
-mindepth 1 \
|
|
61
|
+
-maxdepth 1 \
|
|
62
|
+
-type f \
|
|
63
|
+
-regex '.*/tst-.*\.sh$' \
|
|
64
|
+
-regextype posix-basic \
|
|
65
|
+
-name "$pattern" \
|
|
66
|
+
-printf '%P\0' \
|
|
67
|
+
| sort -z \
|
|
68
|
+
| \
|
|
69
|
+
while IFS= read -d '' -r test_file; do
|
|
70
|
+
test_files+=("$test_file")
|
|
71
|
+
done
|
|
72
|
+
|
|
73
|
+
run_test_file ${test_files[@]+"${test_files[@]}"}
|
|
74
|
+
log_tests_summary
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
main "$@"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
test_run() {
|
|
2
|
+
test_setup
|
|
3
|
+
|
|
4
|
+
local users=(kreed58 korya_mc)
|
|
5
|
+
|
|
6
|
+
test_run_module vk.mutuals --format csv "${users[@]}" > "$test_root_dir/mutuals.csv"
|
|
7
|
+
test_run_module vk.mutuals --format json "${users[@]}" > "$test_root_dir/mutuals.json"
|
|
8
|
+
|
|
9
|
+
local expected=10
|
|
10
|
+
|
|
11
|
+
local actual_csv
|
|
12
|
+
actual_csv="$( cat -- "$test_root_dir/mutuals.csv" | wc -l )"
|
|
13
|
+
log "Mutuals in CSV: $actual_csv"
|
|
14
|
+
|
|
15
|
+
if [ "$actual_csv" -lt "$expected" ]; then
|
|
16
|
+
fail "Expected a lot more mutual friends in CSV output"
|
|
17
|
+
fail_details "Expected: $expected"
|
|
18
|
+
fail_details "Actual: $actual_csv"
|
|
19
|
+
return 1
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
local actual_json
|
|
23
|
+
actual_json="$( grep -F -- '"id":' "$test_root_dir/mutuals.json" | wc -l )"
|
|
24
|
+
log "Mutuals in JSON: $actual_json"
|
|
25
|
+
|
|
26
|
+
if [ "$actual_json" -lt "$expected" ]; then
|
|
27
|
+
fail "Expected a lot more mutual friends in JSON output"
|
|
28
|
+
fail_details "Expected: $expected"
|
|
29
|
+
fail_details "Actual: $actual_json"
|
|
30
|
+
return 1
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
if [ "$actual_csv" -ne "$actual_json" ]; then
|
|
34
|
+
fail "Number of mutuals in CSV unequal to that in JSON"
|
|
35
|
+
fail_details "Can technically happen, because it's kind of a race"
|
|
36
|
+
return 1
|
|
37
|
+
fi
|
|
38
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
test_db_path="$script_dir/data/test_db.csv"
|
|
2
|
+
readonly test_db_path
|
|
3
|
+
|
|
4
|
+
_test_format() {
|
|
5
|
+
local output_path
|
|
6
|
+
output_path="$( mktemp --tmpdir="$test_root_dir" )"
|
|
7
|
+
|
|
8
|
+
test_run_module vk.tracking.sessions "$@" "$test_db_path" "$output_path"
|
|
9
|
+
|
|
10
|
+
if [ ! -s "$output_path" ]; then
|
|
11
|
+
fail "Output file '$output_path' either doesn't exists or is empty"
|
|
12
|
+
return 1
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
if file --brief --dereference --mime -- "$output_path" | grep --quiet -- 'charset=binary$'; then
|
|
16
|
+
log 'Output is a binary file, not going to show that'
|
|
17
|
+
return 0
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
cat -- "$output_path" >&2
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
_test_group_by() {
|
|
24
|
+
local group_by
|
|
25
|
+
for group_by; do
|
|
26
|
+
local format
|
|
27
|
+
for format in csv json plot; do
|
|
28
|
+
_test_format --output-format "$format" --group-by "$group_by"
|
|
29
|
+
done
|
|
30
|
+
done
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
_test_main() {
|
|
34
|
+
_test_group_by user
|
|
35
|
+
_test_group_by hour
|
|
36
|
+
_test_group_by date
|
|
37
|
+
_test_group_by weekday
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
_fix_matplotlib() {
|
|
41
|
+
# Get rid of:
|
|
42
|
+
# tkinter.TclError: no display name and no $DISPLAY environment variable
|
|
43
|
+
mkdir -p -- ~/.config/matplotlib
|
|
44
|
+
echo 'backend: Agg' > ~/.config/matplotlib/matplotlibrc
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
test_run() {
|
|
48
|
+
test_setup
|
|
49
|
+
_fix_matplotlib
|
|
50
|
+
_test_main
|
|
51
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
test_run() {
|
|
2
|
+
test_setup
|
|
3
|
+
|
|
4
|
+
local users=(egor.tensin kreed58)
|
|
5
|
+
local db_path
|
|
6
|
+
db_path="$test_root_dir/db.csv"
|
|
7
|
+
|
|
8
|
+
test_run_module vk.tracking.status --only-once -o "$db_path" "${users[@]}"
|
|
9
|
+
|
|
10
|
+
if [ ! -s "$db_path" ]; then
|
|
11
|
+
fail "Database file '$db_path' either doesn't exists or is empty"
|
|
12
|
+
return 1
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
log "Database:"
|
|
16
|
+
cat -- "$db_path" >&2
|
|
17
|
+
|
|
18
|
+
local lines
|
|
19
|
+
lines="$( cat -- "$db_path" | wc -l )"
|
|
20
|
+
|
|
21
|
+
if [ "$lines" -ne 2 ]; then
|
|
22
|
+
fail "Database '$db_path' has the wrong number of entries"
|
|
23
|
+
return 1
|
|
24
|
+
fi
|
|
25
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
test_run() {
|
|
2
|
+
test_setup
|
|
3
|
+
|
|
4
|
+
local users=(egor.tensin)
|
|
5
|
+
|
|
6
|
+
local log_path
|
|
7
|
+
log_path="$test_root_dir/status.log"
|
|
8
|
+
local db_path
|
|
9
|
+
db_path="$test_root_dir/status.csv"
|
|
10
|
+
|
|
11
|
+
test_run_module vk.tracking.status \
|
|
12
|
+
--log "$log_path" \
|
|
13
|
+
--format csv \
|
|
14
|
+
--output "$db_path" \
|
|
15
|
+
"${users[@]}" &
|
|
16
|
+
local pid="$!"
|
|
17
|
+
|
|
18
|
+
sleep 3
|
|
19
|
+
log "Log file: $log_path"
|
|
20
|
+
log "Database file: $db_path"
|
|
21
|
+
log "PID: $pid"
|
|
22
|
+
|
|
23
|
+
local timeout=10
|
|
24
|
+
log "Sleeping for $timeout seconds..."
|
|
25
|
+
sleep "$timeout"
|
|
26
|
+
|
|
27
|
+
log 'Terminating track_status.py...'
|
|
28
|
+
kill "$pid"
|
|
29
|
+
log 'Waiting for track_status.py to terminate...'
|
|
30
|
+
wait "$pid" || true
|
|
31
|
+
|
|
32
|
+
if [ ! -s "$log_path" ]; then
|
|
33
|
+
fail "Log file '$log_path' either doesn't exists or is empty"
|
|
34
|
+
return 1
|
|
35
|
+
fi
|
|
36
|
+
log 'Log file:'
|
|
37
|
+
cat -- "$log_path" >&2
|
|
38
|
+
|
|
39
|
+
if [ ! -s "$db_path" ]; then
|
|
40
|
+
fail "Database file '$db_path' either doesn't exists or is empty"
|
|
41
|
+
return 1
|
|
42
|
+
fi
|
|
43
|
+
log 'Database:'
|
|
44
|
+
cat -- "$db_path" >&2
|
|
45
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Copyright (c) 2015 Egor Tensin <egor@tensin.name>
|
|
2
2
|
# This file is part of the "VK scripts" project.
|
|
3
|
-
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
3
|
+
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
4
4
|
# Distributed under the MIT License.
|
|
5
5
|
|
|
6
6
|
from collections.abc import Iterable, Mapping
|
|
@@ -66,7 +66,7 @@ def _join_path(base, url):
|
|
|
66
66
|
return urllib.parse.urljoin(base, url)
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
ACCESS_TOKEN = "
|
|
69
|
+
ACCESS_TOKEN = "3d242bac3d242bac3d242bacd03e66eae033d243d242bac5755894cf6163d769859232d"
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
class Version(Enum):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Copyright (c) 2016 Egor Tensin <egor@tensin.name>
|
|
2
2
|
# This file is part of the "VK scripts" project.
|
|
3
|
-
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
3
|
+
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
4
4
|
# Distributed under the MIT License.
|
|
5
5
|
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Copyright (c) 2016 Egor Tensin <egor@tensin.name>
|
|
2
2
|
# This file is part of the "VK scripts" project.
|
|
3
|
-
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
3
|
+
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
4
4
|
# Distributed under the MIT License.
|
|
5
5
|
|
|
6
6
|
from collections import OrderedDict
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Copyright (c) 2015 Egor Tensin <egor@tensin.name>
|
|
2
2
|
# This file is part of the "VK scripts" project.
|
|
3
|
-
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
3
|
+
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
4
4
|
# Distributed under the MIT License.
|
|
5
5
|
|
|
6
6
|
import abc
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Copyright (c) 2016 Egor Tensin <egor@tensin.name>
|
|
2
2
|
# This file is part of the "VK scripts" project.
|
|
3
|
-
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
3
|
+
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
4
4
|
# Distributed under the MIT License.
|
|
5
5
|
|
|
6
6
|
from enum import Enum
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Copyright (c) 2016 Egor Tensin <egor@tensin.name>
|
|
2
2
|
# This file is part of the "VK scripts" project.
|
|
3
|
-
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
3
|
+
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
4
4
|
# Distributed under the MIT License.
|
|
5
5
|
|
|
6
6
|
from .format import Format
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Copyright (c) 2016 Egor Tensin <egor@tensin.name>
|
|
2
2
|
# This file is part of the "VK scripts" project.
|
|
3
|
-
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
3
|
+
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
4
4
|
# Distributed under the MIT License.
|
|
5
5
|
|
|
6
6
|
from . import csv, log, null
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Copyright (c) 2016 Egor Tensin <egor@tensin.name>
|
|
2
2
|
# This file is part of the "VK scripts" project.
|
|
3
|
-
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
3
|
+
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
4
4
|
# Distributed under the MIT License.
|
|
5
5
|
|
|
6
6
|
from vk.utils.io import FileReaderCSV, FileWriterCSV
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Copyright (c) 2016 Egor Tensin <egor@tensin.name>
|
|
2
2
|
# This file is part of the "VK scripts" project.
|
|
3
|
-
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
3
|
+
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
4
4
|
# Distributed under the MIT License.
|
|
5
5
|
|
|
6
6
|
import logging
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Copyright (c) 2016 Egor Tensin <egor@tensin.name>
|
|
2
2
|
# This file is part of the "VK scripts" project.
|
|
3
|
-
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
3
|
+
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
4
4
|
# Distributed under the MIT License.
|
|
5
5
|
|
|
6
6
|
from .. import meta
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Copyright (c) 2016 Egor Tensin <egor@tensin.name>
|
|
2
2
|
# This file is part of the "VK scripts" project.
|
|
3
|
-
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
3
|
+
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
4
4
|
# Distributed under the MIT License.
|
|
5
5
|
|
|
6
6
|
from enum import Enum
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Copyright (c) 2017 Egor Tensin <egor@tensin.name>
|
|
2
2
|
# This file is part of the "VK scripts" project.
|
|
3
|
-
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
3
|
+
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
4
4
|
# Distributed under the MIT License.
|
|
5
5
|
|
|
6
6
|
import abc
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Copyright (c) 2016 Egor Tensin <egor@tensin.name>
|
|
2
2
|
# This file is part of the "VK scripts" project.
|
|
3
|
-
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
3
|
+
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
4
4
|
# Distributed under the MIT License.
|
|
5
5
|
|
|
6
6
|
from collections import OrderedDict
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Copyright (c) 2016 Egor Tensin <egor@tensin.name>
|
|
2
2
|
# This file is part of the "VK scripts" project.
|
|
3
|
-
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
3
|
+
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
4
4
|
# Distributed under the MIT License.
|
|
5
5
|
|
|
6
6
|
from datetime import datetime, timezone
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Copyright (c) 2016 Egor Tensin <egor@tensin.name>
|
|
2
2
|
# This file is part of the "VK scripts" project.
|
|
3
|
-
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
3
|
+
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
4
4
|
# Distributed under the MIT License.
|
|
5
5
|
|
|
6
6
|
import abc
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Copyright (c) 2016 Egor Tensin <egor@tensin.name>
|
|
2
2
|
# This file is part of the "VK scripts" project.
|
|
3
|
-
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
3
|
+
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
4
4
|
# Distributed under the MIT License.
|
|
5
5
|
|
|
6
6
|
import argparse
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Copyright (c) 2016 Egor Tensin <egor@tensin.name>
|
|
2
2
|
# This file is part of the "VK scripts" project.
|
|
3
|
-
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
3
|
+
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
4
4
|
# Distributed under the MIT License.
|
|
5
5
|
|
|
6
6
|
from collections import OrderedDict
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Copyright (c) 2017 Egor Tensin <egor@tensin.name>
|
|
2
2
|
# This file is part of the "VK scripts" project.
|
|
3
|
-
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
3
|
+
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
4
4
|
# Distributed under the MIT License.
|
|
5
5
|
|
|
6
6
|
import matplotlib.pyplot as plt
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Copyright (c) 2017 Egor Tensin <egor@tensin.name>
|
|
2
2
|
# This file is part of the "VK scripts" project.
|
|
3
|
-
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
3
|
+
# For details, see https://github.com/egor-tensin/vk-scripts
|
|
4
4
|
# Distributed under the MIT License.
|
|
5
5
|
|
|
6
6
|
from contextlib import contextmanager
|
|
@@ -14,13 +14,14 @@ docs/images/date.png
|
|
|
14
14
|
docs/images/hour.png
|
|
15
15
|
docs/images/user.png
|
|
16
16
|
docs/images/weekday.png
|
|
17
|
-
test/
|
|
18
|
-
test/
|
|
19
|
-
test/
|
|
20
|
-
test/
|
|
21
|
-
test/
|
|
17
|
+
test/main.sh
|
|
18
|
+
test/tst-mutuals.sh
|
|
19
|
+
test/tst-sessions.sh
|
|
20
|
+
test/tst-status-once.sh
|
|
21
|
+
test/tst-status.sh
|
|
22
|
+
test/data/test_db.csv
|
|
23
|
+
test/lib/log.sh
|
|
22
24
|
test/lib/test.sh
|
|
23
|
-
test/share/test_db.csv
|
|
24
25
|
vk/__init__.py
|
|
25
26
|
vk/api.py
|
|
26
27
|
vk/error.py
|
|
@@ -1,50 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": [
|
|
3
|
-
"README.md",
|
|
4
|
-
"LICENSE.txt",
|
|
5
|
-
"pyproject.toml",
|
|
6
3
|
".git-blame-ignore-revs",
|
|
7
4
|
".gitattributes",
|
|
8
|
-
".
|
|
5
|
+
".github/dependabot.yml",
|
|
6
|
+
".github/workflows/ci.yml",
|
|
9
7
|
".gitignore",
|
|
8
|
+
".pylintrc",
|
|
9
|
+
"LICENSE.txt",
|
|
10
|
+
"README.md",
|
|
11
|
+
"docs/images/date.png",
|
|
12
|
+
"docs/images/hour.png",
|
|
13
|
+
"docs/images/user.png",
|
|
14
|
+
"docs/images/weekday.png",
|
|
10
15
|
"docs/mutuals.md",
|
|
11
16
|
"docs/sessions.md",
|
|
12
17
|
"docs/status.md",
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
+
"pyproject.toml",
|
|
19
|
+
"test/data/test_db.csv",
|
|
20
|
+
"test/lib/log.sh",
|
|
21
|
+
"test/lib/test.sh",
|
|
22
|
+
"test/main.sh",
|
|
23
|
+
"test/tst-mutuals.sh",
|
|
24
|
+
"test/tst-sessions.sh",
|
|
25
|
+
"test/tst-status-once.sh",
|
|
26
|
+
"test/tst-status.sh",
|
|
18
27
|
"vk/__init__.py",
|
|
19
|
-
"vk/version.py",
|
|
20
|
-
"vk/user.py",
|
|
21
|
-
"vk/platform.py",
|
|
22
28
|
"vk/api.py",
|
|
23
|
-
"vk/
|
|
29
|
+
"vk/error.py",
|
|
24
30
|
"vk/last_seen.py",
|
|
25
|
-
"vk/
|
|
26
|
-
"vk/
|
|
27
|
-
"vk/utils/io.py",
|
|
31
|
+
"vk/mutuals.py",
|
|
32
|
+
"vk/platform.py",
|
|
28
33
|
"vk/tracking/__init__.py",
|
|
29
|
-
"vk/tracking/status.py",
|
|
30
|
-
"vk/tracking/sessions.py",
|
|
31
34
|
"vk/tracking/db/__init__.py",
|
|
32
|
-
"vk/tracking/db/
|
|
35
|
+
"vk/tracking/db/backend/__init__.py",
|
|
36
|
+
"vk/tracking/db/backend/csv.py",
|
|
37
|
+
"vk/tracking/db/backend/log.py",
|
|
38
|
+
"vk/tracking/db/backend/null.py",
|
|
33
39
|
"vk/tracking/db/format.py",
|
|
34
40
|
"vk/tracking/db/meta.py",
|
|
41
|
+
"vk/tracking/db/record.py",
|
|
35
42
|
"vk/tracking/db/timestamp.py",
|
|
36
|
-
"vk/tracking/
|
|
37
|
-
"vk/tracking/
|
|
38
|
-
"vk/
|
|
39
|
-
"vk/
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"test/bin/mutuals.sh",
|
|
44
|
-
"test/bin/status_once.sh",
|
|
45
|
-
"test/bin/status.sh",
|
|
46
|
-
"test/share/test_db.csv",
|
|
47
|
-
".github/dependabot.yml",
|
|
48
|
-
".github/workflows/ci.yml"
|
|
43
|
+
"vk/tracking/sessions.py",
|
|
44
|
+
"vk/tracking/status.py",
|
|
45
|
+
"vk/user.py",
|
|
46
|
+
"vk/utils/__init__.py",
|
|
47
|
+
"vk/utils/bar_chart.py",
|
|
48
|
+
"vk/utils/io.py",
|
|
49
|
+
"vk/version.py"
|
|
49
50
|
]
|
|
50
51
|
}
|
vk_scripts-1.1/test/bin/main.sh
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
# Copyright (c) 2019 Egor Tensin <egor@tensin.name>
|
|
4
|
-
# This file is part of the "VK scripts" project.
|
|
5
|
-
# For details, see https://github.com/egor-tensin/vk-scripts.
|
|
6
|
-
# Distributed under the MIT License.
|
|
7
|
-
|
|
8
|
-
set -o errexit -o nounset -o pipefail
|
|
9
|
-
|
|
10
|
-
script_dir="$( dirname -- "${BASH_SOURCE[0]}" )"
|
|
11
|
-
script_dir="$( cd -- "$script_dir" && pwd )"
|
|
12
|
-
readonly script_dir
|
|
13
|
-
|
|
14
|
-
"$script_dir/mutuals.sh"
|
|
15
|
-
|
|
16
|
-
"$script_dir/sessions.sh"
|
|
17
|
-
|
|
18
|
-
"$script_dir/status_once.sh"
|
|
19
|
-
"$script_dir/status.sh"
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
# Copyright (c) 2019 Egor Tensin <egor@tensin.name>
|
|
4
|
-
# This file is part of the "VK scripts" project.
|
|
5
|
-
# For details, see https://github.com/egor-tensin/vk-scripts.
|
|
6
|
-
# Distributed under the MIT License.
|
|
7
|
-
|
|
8
|
-
set -o errexit -o nounset -o pipefail
|
|
9
|
-
|
|
10
|
-
script_dir="$( dirname -- "${BASH_SOURCE[0]}" )"
|
|
11
|
-
script_dir="$( cd -- "$script_dir" && pwd )"
|
|
12
|
-
readonly script_dir
|
|
13
|
-
|
|
14
|
-
test_users() {
|
|
15
|
-
"$script_dir/../lib/test.sh" vk.mutuals --format csv "$@"
|
|
16
|
-
"$script_dir/../lib/test.sh" vk.mutuals --format json "$@"
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
main() {
|
|
20
|
-
test_users kreed58 korya_mc
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
main
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
# Copyright (c) 2019 Egor Tensin <egor@tensin.name>
|
|
4
|
-
# This file is part of the "VK scripts" project.
|
|
5
|
-
# For details, see https://github.com/egor-tensin/vk-scripts.
|
|
6
|
-
# Distributed under the MIT License.
|
|
7
|
-
|
|
8
|
-
set -o errexit -o nounset -o pipefail
|
|
9
|
-
|
|
10
|
-
script_dir="$( dirname -- "${BASH_SOURCE[0]}" )"
|
|
11
|
-
script_dir="$( cd -- "$script_dir" && pwd )"
|
|
12
|
-
readonly script_dir
|
|
13
|
-
script_name="$( basename -- "${BASH_SOURCE[0]}" )"
|
|
14
|
-
readonly script_name
|
|
15
|
-
|
|
16
|
-
readonly db_path="$script_dir/../share/test_db.csv"
|
|
17
|
-
|
|
18
|
-
dump() {
|
|
19
|
-
local msg
|
|
20
|
-
for msg; do
|
|
21
|
-
echo "$script_name: $msg"
|
|
22
|
-
done
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
test_output() {
|
|
26
|
-
local output_path
|
|
27
|
-
output_path="$( mktemp --dry-run )"
|
|
28
|
-
|
|
29
|
-
local rm_aux_files
|
|
30
|
-
rm_aux_files="$( printf -- 'rm -f -- %q' "$output_path" )"
|
|
31
|
-
|
|
32
|
-
trap "$rm_aux_files" RETURN
|
|
33
|
-
|
|
34
|
-
"$script_dir/../lib/test.sh" vk.tracking.sessions "$@" "$db_path" "$output_path"
|
|
35
|
-
|
|
36
|
-
if file --brief --dereference --mime -- "$output_path" | grep --quiet -- 'charset=binary$'; then
|
|
37
|
-
dump 'Output is a binary file, not going to show that'
|
|
38
|
-
return 0
|
|
39
|
-
fi
|
|
40
|
-
|
|
41
|
-
cat "$output_path"
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
group_by() {
|
|
45
|
-
test_output --output-format csv --group-by "$@"
|
|
46
|
-
test_output --output-format json --group-by "$@"
|
|
47
|
-
test_output --output-format plot --group-by "$@"
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
online_sessions() {
|
|
51
|
-
group_by user
|
|
52
|
-
group_by hour
|
|
53
|
-
group_by date
|
|
54
|
-
group_by weekday
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
fix_matplotlib() {
|
|
58
|
-
# Get rid of:
|
|
59
|
-
# tkinter.TclError: no display name and no $DISPLAY environment variable
|
|
60
|
-
mkdir -p -- ~/.config/matplotlib
|
|
61
|
-
echo 'backend: Agg' > ~/.config/matplotlib/matplotlibrc
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
main() {
|
|
65
|
-
fix_matplotlib
|
|
66
|
-
online_sessions
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
main
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
# Copyright (c) 2019 Egor Tensin <egor@tensin.name>
|
|
4
|
-
# This file is part of the "VK scripts" project.
|
|
5
|
-
# For details, see https://github.com/egor-tensin/vk-scripts.
|
|
6
|
-
# Distributed under the MIT License.
|
|
7
|
-
|
|
8
|
-
set -o errexit -o nounset -o pipefail
|
|
9
|
-
|
|
10
|
-
script_dir="$( dirname -- "${BASH_SOURCE[0]}" )"
|
|
11
|
-
script_dir="$( cd -- "$script_dir" && pwd )"
|
|
12
|
-
readonly script_dir
|
|
13
|
-
script_name="$( basename -- "${BASH_SOURCE[0]}" )"
|
|
14
|
-
readonly script_name
|
|
15
|
-
|
|
16
|
-
dump() {
|
|
17
|
-
local msg
|
|
18
|
-
for msg; do
|
|
19
|
-
echo "$script_name: $msg"
|
|
20
|
-
done
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
test_users() {
|
|
24
|
-
local log_path
|
|
25
|
-
log_path="$( mktemp )"
|
|
26
|
-
local db_path
|
|
27
|
-
db_path="$( mktemp --dry-run )"
|
|
28
|
-
|
|
29
|
-
local rm_aux_files
|
|
30
|
-
rm_aux_files="$( printf -- 'rm -f -- %q %q' "$log_path" "$db_path" )"
|
|
31
|
-
trap "$rm_aux_files" RETURN
|
|
32
|
-
|
|
33
|
-
"$script_dir/../lib/test.sh" vk.tracking.status "$@" --log "$log_path" --format csv --output "$db_path" &
|
|
34
|
-
local pid="$!"
|
|
35
|
-
|
|
36
|
-
sleep 3
|
|
37
|
-
dump "Log file path: $log_path"
|
|
38
|
-
dump "DB file path: $db_path"
|
|
39
|
-
dump "PID: $pid"
|
|
40
|
-
|
|
41
|
-
local timeout=10
|
|
42
|
-
dump "Sleeping for $timeout seconds..."
|
|
43
|
-
sleep "$timeout"
|
|
44
|
-
|
|
45
|
-
dump 'Terminating track_status.py...'
|
|
46
|
-
kill "$pid"
|
|
47
|
-
dump 'Waiting for track_status.py to terminate...'
|
|
48
|
-
wait "$pid" || true
|
|
49
|
-
|
|
50
|
-
dump "Log file:"
|
|
51
|
-
cat "$log_path"
|
|
52
|
-
dump "DB:"
|
|
53
|
-
cat "$db_path"
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
main() {
|
|
57
|
-
test_users egor.tensin
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
main "$@"
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
# Copyright (c) 2019 Egor Tensin <egor@tensin.name>
|
|
4
|
-
# This file is part of the "VK scripts" project.
|
|
5
|
-
# For details, see https://github.com/egor-tensin/vk-scripts.
|
|
6
|
-
# Distributed under the MIT License.
|
|
7
|
-
|
|
8
|
-
set -o errexit -o nounset -o pipefail
|
|
9
|
-
|
|
10
|
-
script_dir="$( dirname -- "${BASH_SOURCE[0]}" )"
|
|
11
|
-
script_dir="$( cd -- "$script_dir" && pwd )"
|
|
12
|
-
readonly script_dir
|
|
13
|
-
|
|
14
|
-
test_users() {
|
|
15
|
-
"$script_dir/../lib/test.sh" vk.tracking.status --only-once "$@"
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
main() {
|
|
19
|
-
test_users egor.tensin
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
main
|
vk_scripts-1.1/test/lib/test.sh
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
# Copyright (c) 2020 Egor Tensin <egor@tensin.name>
|
|
4
|
-
# This file is part of the "VK scripts" project.
|
|
5
|
-
# For details, see https://github.com/egor-tensin/vk-scripts.
|
|
6
|
-
# Distributed under the MIT License.
|
|
7
|
-
|
|
8
|
-
set -o errexit -o nounset -o pipefail
|
|
9
|
-
|
|
10
|
-
script_dir="$( dirname -- "${BASH_SOURCE[0]}" )"
|
|
11
|
-
script_dir="$( cd -- "$script_dir" && pwd )"
|
|
12
|
-
readonly script_dir
|
|
13
|
-
|
|
14
|
-
run_test() {
|
|
15
|
-
local arg
|
|
16
|
-
echo
|
|
17
|
-
echo ======================================================================
|
|
18
|
-
for arg; do
|
|
19
|
-
echo -n "$arg "
|
|
20
|
-
done
|
|
21
|
-
echo
|
|
22
|
-
echo ======================================================================
|
|
23
|
-
|
|
24
|
-
PYTHONPATH="$script_dir/../.." python -m "$@"
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
run_test "$@"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|