Skip to content

Commit

Permalink
test: ensure via testing all test*.py files call get_env_vars() with …
Browse files Browse the repository at this point in the history
…test=True

Signed-off-by: Zack Koppert <[email protected]>
  • Loading branch information
zkoppert committed Apr 16, 2024
1 parent 0856d7d commit f76ff46
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/scripts/env_vars_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Find all test_*.py files
files=$(find . -name "test_*.py")
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color

# Loop through each file
for file in $files; do
# Search for instances of get_env_vars() with no arguments
result=$(grep -n "get_env_vars()" "$file")

# If any instances are found, print the file name and line number
if [ -n "$result" ]; then
echo "Found in $file:"
echo "$result"
echo -e "${RED}ERROR: get_env_vars() should always set test=True in test*.py files.${NC}"
exit 1
fi
done
echo -e " ${GREEN}PASS:${NC} All test*.py files call get_env_vars() with test=True."
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.PHONY: test
test:
pytest -v --cov=. --cov-config=.coveragerc --cov-fail-under=80 --cov-report term-missing
.github/scripts/env_vars_check.sh

.PHONY: clean
clean:
Expand Down

0 comments on commit f76ff46

Please sign in to comment.