mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
added commands to run tests
This commit is contained in:
parent
777e03d884
commit
ea905daeca
2 changed files with 22 additions and 0 deletions
|
|
@ -240,6 +240,13 @@ function Run-From-Code {
|
|||
& $Poetry $RunArgs @arguments
|
||||
}
|
||||
|
||||
function Run-Tests {
|
||||
$Poetry = "$RepoRoot\.poetry\bin\poetry.exe"
|
||||
$RunArgs = @( "run", "pytest", "$($RepoRoot)/tests")
|
||||
|
||||
& $Poetry $RunArgs @arguments
|
||||
}
|
||||
|
||||
function Write-Help {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
|
@ -256,6 +263,7 @@ function Write-Help {
|
|||
Write-Info -Text " ruff-fix ", "Run Ruff fix for the repository" -Color White, Cyan
|
||||
Write-Info -Text " codespell ", "Run codespell check for the repository" -Color White, Cyan
|
||||
Write-Info -Text " run ", "Run a poetry command in the repository environment" -Color White, Cyan
|
||||
Write-Info -Text " run-tests ", "Run ayon-core tests" -Color White, Cyan
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
|
|
@ -280,6 +288,9 @@ function Resolve-Function {
|
|||
} elseif ($FunctionName -eq "run") {
|
||||
Set-Cwd
|
||||
Run-From-Code
|
||||
} elseif ($FunctionName -eq "runtests") {
|
||||
Set-Cwd
|
||||
Run-Tests
|
||||
} else {
|
||||
Write-Host "Unknown function ""$FunctionName"""
|
||||
Write-Help
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ default_help() {
|
|||
echo -e " ${BWhite}ruff-fix${RST} ${BCyan}Run Ruff fix for the repository${RST}"
|
||||
echo -e " ${BWhite}codespell${RST} ${BCyan}Run codespell check for the repository${RST}"
|
||||
echo -e " ${BWhite}run${RST} ${BCyan}Run a poetry command in the repository environment${RST}"
|
||||
echo -e " ${BWhite}run-tests${RST} ${BCyan}Run ayon-core tests${RST}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
|
|
@ -182,6 +183,12 @@ run_command () {
|
|||
"$POETRY_HOME/bin/poetry" run "$@"
|
||||
}
|
||||
|
||||
run_tests () {
|
||||
echo -e "${BIGreen}>>>${RST} Running tests..."
|
||||
shift; # will remove first arg ("run-tests") from the "$@"
|
||||
"$POETRY_HOME/bin/poetry" run pytest ./tests
|
||||
}
|
||||
|
||||
main () {
|
||||
detect_python || return 1
|
||||
|
||||
|
|
@ -218,6 +225,10 @@ main () {
|
|||
run_command "$@" || return_code=$?
|
||||
exit $return_code
|
||||
;;
|
||||
"runtests")
|
||||
run_tests "$@" || return_code=$?
|
||||
exit $return_code
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$function_name" != "" ]; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue