-
Notifications
You must be signed in to change notification settings - Fork 660
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added helper script to run multiple tox environments
- Loading branch information
1 parent
6631e89
commit 2b1a120
Showing
1 changed file
with
31 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,31 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Usage: | ||
# ./scripts/runtox.sh py312 <pytest-args> | ||
# | ||
# Runs all environments with substring "py312" and the given arguments for pytest | ||
# | ||
|
||
# Print commands and exit on first error | ||
set -ex | ||
|
||
# Find the right tox executable | ||
if [ -n "$TOXPATH" ]; then | ||
true | ||
elif which tox &> /dev/null; then | ||
TOXPATH=tox | ||
else | ||
TOXPATH=./.venv/bin/tox | ||
fi | ||
|
||
# Find the environments matching the searchstring | ||
searchstring="$1" | ||
ENV="$($TOXPATH -l | grep -- "$searchstring" | tr $'\n' ',')" | ||
|
||
if [ -z "${ENV}" ]; then | ||
echo "No targets found. Skipping." | ||
exit 0 | ||
fi | ||
|
||
# Run tox with all matching environments | ||
exec $TOXPATH -e "$ENV" -- "${@:2}" |