-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: ensure via testing all test*.py files call get_env_vars() with …
…test=True Signed-off-by: Zack Koppert <[email protected]>
- Loading branch information
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters