Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pr_unittests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ jobs:
- name: Run tests
env:
QT_QPA_PLATFORM: offscreen
run: ./tools/manage.sh run-tests
run: ./tools/manage.sh run-tests --optional
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,6 @@ poetry.lock

# ignore mkdocs build
site/

# handle test images from tests
test_images
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ mypy_path = "$MYPY_CONFIG_FILE_DIR/client"
[tool.pytest.ini_options]
log_cli = true
log_cli_level = "INFO"
addopts = "-ra -q"
addopts = "-ra -q -m 'not optional'"
testpaths = [
"client/ayon_core/tests",
"tests/client/ayon_core/ui",
Expand All @@ -82,4 +82,5 @@ markers = [
"cli: CLI tests",
"slow: Slow tests",
"server: Tests that require a running AYON server",
"optional: Tests excluded from the default test run",
]
3 changes: 3 additions & 0 deletions tests/client/ayon_core/ui/test_visual.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
from widget_test import WidgetTest


pytestmark = pytest.mark.optional


def _collect_widget_test_classes() -> list[Type[WidgetTest]]:
"""Import all test_*.py modules under tests/components/ and return
WidgetTest subclasses."""
Expand Down
20 changes: 16 additions & 4 deletions tools/manage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,21 @@ function Run-From-Code {
}

function Run-Tests {
$RunArgs = @( "run", "pytest", "$($RepoRoot)/tests", "-m", "not server")
param(
[string[]]$TestArguments
)

$TestMarker = "not server and not optional"
if ($TestArguments -contains "--optional" -or $TestArguments -contains "-optional") {
Comment thread
antirotor marked this conversation as resolved.
$TestMarker = "not server"
}

$RunArgs = @(
"run", "pytest", "$($RepoRoot)/tests", "-m",
$TestMarker
)
& uv sync --extra test
& uv $RunArgs @arguments
& uv $RunArgs
}
Comment thread
antirotor marked this conversation as resolved.

function Write-Help {
Expand All @@ -228,7 +240,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 uv command in the repository environment" -Color White, Cyan
Write-Info -Text " run-tests ", "Run ayon-core tests" -Color White, Cyan
Write-Info -Text " run-tests --optional ", "Run ayon-core tests including optional tests" -Color White, Cyan
Write-Host ""
}

Expand All @@ -255,7 +267,7 @@ function Resolve-Function {
Run-From-Code
} elseif ($FunctionName -eq "runtests") {
Set-Cwd
Run-Tests
Run-Tests -TestArguments $Arguments
} else {
Write-Host "Unknown function ""$FunctionName"""
Write-Help
Expand Down
8 changes: 6 additions & 2 deletions tools/manage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,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 uv command in the repository environment${RST}"
echo -e " ${BWhite}run-tests${RST} ${BCyan}Run ayon-core tests${RST}"
echo -e " ${BWhite}run-tests --optional${RST} ${BCyan}Run ayon-core tests including optional tests${RST}"
Comment thread
Copilot marked this conversation as resolved.
echo ""
}

Expand Down Expand Up @@ -172,8 +172,12 @@ run_command () {
run_tests () {
echo -e "${BIGreen}>>>${RST} Running tests..."
shift; # will remove first arg ("run-tests") from the "$@"
local test_marker="not server and not optional"
if [ "$1" = "--optional" ]; then
test_marker="not server"
fi
uv sync --extra test
uv run pytest ./tests -m "not server"
uv run pytest ./tests -m "$test_marker"
}

main () {
Expand Down
Loading