Skip to main content

ts: remove some more special casing

ID
b547f86
date
2026-04-20 05:21:12+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
8319c26
message
ts: remove some more special casing
changed files
1 file, 12 additions, 22 deletions

Changed files

ts (2296) → ts (1907)

diff --git a/ts b/ts
index ce92e71..56c4ef2 100755
--- a/ts
+++ b/ts
@@ -4,12 +4,16 @@ set -o errexit
 set -o nounset
 
 function run_python_tests() {
-    # If there's a `scripts` folder with a test script, run that
-    if find scripts -name 'run_*_tests.sh' >/dev/null; then
-        print_info "-> bash scripts/run_*_tests.sh"
-        bash scripts/run_*_tests.sh
-        return 0
-    fi
+    GIT_ROOT=$(git rev-parse --show-toplevel)
+  
+    pushd "$GIT_ROOT" >/dev/null
+      # If there's a `scripts` folder with a test script, run that
+      if find "scripts" -name 'run_*_tests.sh' >/dev/null; then
+          print_info "-> bash scripts/run_*_tests.sh"
+          bash scripts/run_*_tests.sh
+          return 0
+      fi
+    popd >/dev/null
   
     REPO_NAME="$(basename $(pwd))"
 
@@ -30,10 +34,6 @@ function run_python_tests() {
     then
         print_info '-> mypy *.py src tests'
         mypy *.py src tests
-    elif [[ "$REPO_NAME" = "yt-dlp_alexwlchan" ]]
-    then
-        print_info '-> mypy *.py'
-        mypy *.py
     else
         print_info '-> mypy src tests'
 
@@ -52,18 +52,8 @@ function run_python_tests() {
     # I have a couple of repos which are a bit special and need a
     # different command because I use pytest-xdist, but not all
     # my repos work that way.
-    if [[ "$REPO_NAME" = "yt-dlp_alexwlchan" ]]
-    then
-        print_info "-> coverage run -m pytest test_yt-dlp_alexwlchan.py"
-        coverage run -m pytest test_yt-dlp_alexwlchan.py
-    elif [[ "$REPO_NAME" = "prep_for_itunes" ]]
-    then
-        print_info "-> coverage run -m pytest test_prep_for_itunes.py"
-        coverage run -m pytest test_prep_for_itunes.py
-    else
-        print_info "-> coverage run -m pytest tests"
-        coverage run -m pytest tests --quiet
-    fi
+    print_info "-> coverage run -m pytest tests"
+    coverage run -m pytest tests --quiet
 
     echo ""