mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-08 09:39:16 +00:00
tests refactoring
This commit is contained in:
10
scripts/check-doc.sh
vendored
10
scripts/check-doc.sh
vendored
@@ -1,9 +1,9 @@
|
||||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
# author: deadc0de6 (https://github.com/deadc0de6)
|
||||
# Copyright (c) 2022, deadc0de6
|
||||
|
||||
# stop on first error
|
||||
set -e
|
||||
set -euo errtrace pipefail
|
||||
|
||||
## test doc external links
|
||||
echo "------------------------"
|
||||
@@ -16,11 +16,7 @@ done
|
||||
## https://github.com/remarkjs/remark-validate-links
|
||||
## https://github.com/tcort/markdown-link-check
|
||||
## npm install -g remark-cli remark-validate-links
|
||||
set +e
|
||||
which remark >/dev/null 2>&1
|
||||
r="$?"
|
||||
set -e
|
||||
if [ "$r" != "0" ]; then
|
||||
if ! which remark >/dev/null 2>&1; then
|
||||
echo "[WARNING] install \"remark\" to test the doc"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
14
scripts/check-syntax.sh
vendored
14
scripts/check-syntax.sh
vendored
@@ -1,9 +1,9 @@
|
||||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
# author: deadc0de6 (https://github.com/deadc0de6)
|
||||
# Copyright (c) 2022, deadc0de6
|
||||
|
||||
# stop on first error
|
||||
set -e
|
||||
set -euo errtrace pipefail
|
||||
|
||||
# ensure binaries are here
|
||||
if ! which shellcheck >/dev/null 2>&1; then
|
||||
@@ -43,6 +43,14 @@ grep -rv 'TODO\|FIXME' tests/ >/dev/null 2>&1
|
||||
grep -rv 'TODO\|FIXME' tests-ng/ >/dev/null 2>&1
|
||||
grep -rv 'TODO\|FIXME' scripts/ >/dev/null 2>&1
|
||||
|
||||
# checking for tests options
|
||||
echo "---------------------------------"
|
||||
echo "checking for bash strict mode"
|
||||
find tests-ng -iname '*.sh' | while read -r script; do
|
||||
#grep 'set +e' "${script}" 2>&1 >/dev/null && echo "set +e found in ${script}" && exit 1
|
||||
grep 'set \-euxo errtrace pipefailuxo errtrace pipefail' "${script}" || (echo "set -euo errtrace pipefail not set in ${script}" && exit 1 )
|
||||
done
|
||||
|
||||
# PEP8 tests
|
||||
# W503: Line break occurred before a binary operator
|
||||
# W504: Line break occurred after a binary operator
|
||||
@@ -114,11 +122,9 @@ done
|
||||
|
||||
echo "------------------------"
|
||||
echo "checking for more issues"
|
||||
set +e
|
||||
exceptions="save_uservariables_name\|@@\|diff_cmd\|original,\|modified,"
|
||||
# f-string errors and missing f literal
|
||||
find dotdrop/ -iname '*.py' -exec grep --with-filename -n -v "f'" {} \; | grep -v "{'" | grep -v "${exceptions}" | grep "'.*}" && echo "bad string format (1)" && exit 1
|
||||
find dotdrop/ -iname '*.py' -exec grep --with-filename -n -v 'f"' {} \; | grep -v "f'" | grep -v '{"' | grep -v "${exceptions}" | grep '".*}' && echo "bad string format (2)" && exit 1
|
||||
set -e
|
||||
|
||||
echo "syntax OK"
|
||||
11
scripts/check-tests-ng.sh
vendored
11
scripts/check-tests-ng.sh
vendored
@@ -1,9 +1,9 @@
|
||||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
# author: deadc0de6 (https://github.com/deadc0de6)
|
||||
# Copyright (c) 2023, deadc0de6
|
||||
|
||||
# stop on first error
|
||||
set -e
|
||||
set -euo errtrace pipefail
|
||||
|
||||
tmpworkdir="/tmp/dotdrop-tests-workdir"
|
||||
export DOTDROP_WORKDIR="${tmpworkdir}"
|
||||
@@ -13,7 +13,8 @@ workdir_tmp_exists="no"
|
||||
[ -d "${HOME}/.config/dotdrop/tmp" ] && workdir_tmp_exists="yes"
|
||||
|
||||
# run bash tests
|
||||
if [ -z "${GITHUB_WORKFLOW}" ]; then
|
||||
GH_WORKFLOW=${GITHUB_WORKFLOW:-}
|
||||
if [ -z "${GH_WORKFLOW}" ]; then
|
||||
## local
|
||||
tests-ng/tests_launcher.py -s
|
||||
else
|
||||
@@ -26,4 +27,6 @@ fi
|
||||
# clear workdir
|
||||
[ "${workdir_tmp_exists}" = "no" ] && rm -rf ~/.config/dotdrop/tmp
|
||||
# clear temp workdir
|
||||
rm -rf "${tmpworkdir}"
|
||||
rm -rf "${tmpworkdir}"
|
||||
|
||||
echo "tests-ng done"
|
||||
7
scripts/check-unittests.sh
vendored
7
scripts/check-unittests.sh
vendored
@@ -1,11 +1,12 @@
|
||||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
# author: deadc0de6 (https://github.com/deadc0de6)
|
||||
# Copyright (c) 2023, deadc0de6
|
||||
|
||||
# stop on first error
|
||||
set -e
|
||||
set -euo errtrace pipefail
|
||||
|
||||
if [ -n "${DOTDROP_WORKERS}" ]; then
|
||||
WORKERS=${DOTDROP_WORKERS:-}
|
||||
if [ -n "${WORKERS}" ]; then
|
||||
unset DOTDROP_WORKERS
|
||||
echo "DISABLE workers for unittests"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user