Add more debugging to my ts script; make it easier to follow
- ID
4e7e5ec- date
2025-04-23 12:58:56+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
68f6582- message
Add more debugging to my `ts` script; make it easier to follow- changed files
2 files, 52 additions, 6 deletions
Changed files
debug/print_info (80) → debug/print_info (228)
diff --git a/debug/print_info b/debug/print_info
index 88cf169..a034b46 100755
--- a/debug/print_info
+++ b/debug/print_info
@@ -3,4 +3,10 @@
set -o errexit
set -o nounset
-echo -e "\033[34m$1\033[0m"
+# This allows you to call `-n` to print without a trailing newline
+if [[ "$#" = "2" && "$1" = "-n" ]]
+then
+ echo -ne "\033[34m$2\033[0m"
+else
+ echo -e "\033[34m$1\033[0m"
+fi
ts (689) → ts (1518)
diff --git a/ts b/ts
index 771f94a..b4dcef4 100755
--- a/ts
+++ b/ts
@@ -4,30 +4,70 @@ set -o errexit
set -o nounset
function run_python_tests() {
- export FLICKR_API_KEY=$(keyring get flickr_api key 2>/dev/null)
+
+ # In the test suites for flickr.org work, I need a Flickr API key
+ # to run certain tests.
+ #
+ # If I need an API key for my tests, retrieve it from the keychain.
+ if grep -rIq 'FLICKR_API_KEY' tests
+ then
+ export FLICKR_API_KEY=$(keyring get flickr_api key 2>/dev/null)
+ fi
+ # Run ruff to do Python formatting
+ print_info "-> ruff check"
ruff check .
+
+ echo ""
+
+ print_info "-> ruff format"
ruff format .
-
- interrogate -vv
+
+ echo ""
+
+ print_info "-> interrogate"
+ if ! interrogate
+ then
+ interrogate -vv
+ fi
+
+ echo ""
# This is one repo which is a bit special -- I'm gradually trying to chase
# the code into `src`, but for now I have to remmeber to look at *.py
if [[ "$(pwd)" == ~/repos/library-lookup ]]
then
+ print_info '-> mypy *.py src tests'
mypy *.py src tests
else
+ print_info '-> mypy src tests'
mypy src tests
fi
+
+ echo ""
- coverage run -m pytest tests
+ print_info "-> coverage run -m pytest tests"
+ coverage run -m pytest tests --quiet
+
+ echo ""
+
+ print_info "-> coverage report"
coverage report
}
function run_rust_tests() {
+ print_info "-> cargo fmt"
cargo fmt
+
+ echo ""
+
+ print_info "-> cargo build"
cargo build
- cargo test
+
+ echo ""
+
+ print_info -n "-> cargo test"
+ cargo test --quiet
}
if test -f Cargo.toml