Files
astronomy/generate/unit_test_python
Don Cross 67dd5dc691 Attempt to make GitHub Actions run the same python I told it to install.
It looks like I have been running an unintended version of Python
from GitHub Actions.  In Linux/Mac I used `python3`, and in Windows
I used `py`. It appears that I should be executing `python` in
all 3 operating systems.

This is an experiment to see if I can get everyone on the same page.
2024-05-30 12:57:43 -04:00

30 lines
921 B
Bash
Executable File

#!/bin/bash
Fail()
{
echo "ERROR($0): $1"
exit 1
}
[[ "$1" == "" || "$1" == "-v" ]] || Fail "Invalid command line options."
python --version || Fail "Cannot print python version"
echo "$0: running mypy"
cd ../source/python/astronomy || Fail "error changing to Python source directory"
mypy --strict --module astronomy || Fail "error checking types using mypy"
cd ../../../generate || Fail "error changing back to generate directory"
echo ""
echo "$0: running unit tests"
python test.py $1 all || Fail "Failed Python unit tests."
for file in temp/py_longitude_*.txt; do
./generate $1 check ${file} || Fail "Failed verification of file ${file}"
done
echo "$0: Generating Python test output."
time python test.py astro_check > temp/py_check.txt || Fail "Failure in Python astro_check"
./generate $1 check temp/py_check.txt || Fail "Verification failure for Python unit test output."
echo "$0: PASS"
exit 0