diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 05580a5..f81c45f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,7 +36,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ 'ubuntu-22.04', 'macos-11' ] + os: [ 'ubuntu-22.04', 'macos-12' ] python: [ '3.7', '3.8', '3.9', '3.10', '3.11' ] name: Python ${{ matrix.python }} (${{ matrix.os }}) steps: diff --git a/csv2txf_test.sh b/csv2txf_test.sh index 25625aa..60cb1ee 100755 --- a/csv2txf_test.sh +++ b/csv2txf_test.sh @@ -23,6 +23,12 @@ fi declare -i num_failures=0 +# macOS 12+ doesn't provide /usr/bin/python, but provides /usr/bin/python3 +PYTHON="" +if ! [[ -f "/usr/bin/python" ]] && [[ -f "/usr/bin/python3" ]]; then + PYTHON="python3" +fi + # Args: # $0: file with expected stdout # $*: command-line flags for csv2txf.py for this run @@ -32,7 +38,7 @@ function test_csv2txf() { if [ $regen -ne 0 ]; then echo "Updating ${expected_out} ..." - ./csv2txf.py "$@" -o "${expected_out}" + ${PYTHON} ./csv2txf.py "$@" -o "${expected_out}" return fi @@ -40,7 +46,7 @@ function test_csv2txf() { local base="$(basename ${expected_out})" local out="$(mktemp /tmp/csv2txf.${base}.out.XXXXXX)" local err="$(mktemp /tmp/csv2txf.${base}.err.XXXXXX)" - ./csv2txf.py "$@" -o "${out}" 2> "${err}" + ${PYTHON} ./csv2txf.py "$@" -o "${out}" 2> "${err}" diff -u "${expected_out}" "${out}" || { cat "${err}" diff --git a/run_all_tests.sh b/run_all_tests.sh index 355e02d..11b435b 100755 --- a/run_all_tests.sh +++ b/run_all_tests.sh @@ -16,11 +16,18 @@ declare -i success=0 +# macOS 12+ doesn't provide /usr/bin/python, but provides /usr/bin/python3 +PYTHON="" +if ! [[ -f "/usr/bin/python" ]] && [[ -f "/usr/bin/python3" ]]; then + PYTHON="python3" +fi + for test in *_test.* ; do test_out="$(mktemp "/tmp/csv2txf.${test}.XXXXXX")" + echo -n "Testing ${test} ... " if [[ ${test} =~ _test.py ]] && [ -n "${PYTHON:-}" ]; then echo -n "Testing ${test} (with ${PYTHON}) ... " - "${PYTHON}" "./${test}" > "${test_out}" 2>&1 + ${PYTHON} "./${test}" > "${test_out}" 2>&1 else echo -n "Testing ${test} ... " "./${test}" > "${test_out}" 2>&1