diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4538e90..fb6e61a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -64,10 +64,6 @@ jobs: python -m pip install --upgrade pip python -m pip install uv - - name: Set up prysk - run: | - uv tool install prysk - - name: Set up jgo run: | uv tool install --with-editable ".[cli]" jgo diff --git a/bin/test.sh b/bin/test.sh index 940ceb5..5e058e8 100755 --- a/bin/test.sh +++ b/bin/test.sh @@ -3,61 +3,8 @@ dir=$(dirname "$0") cd "$dir/.." -pytest_args=() -prysk_args=() - -if [ $# -eq 0 ]; then - # No args: run both on tests directory - pytest_args+=("tests") - prysk_args+=("tests") -else - # Partition args: .py and ::* go to pytest, .t to prysk, others to both - for arg in "$@"; do - case "$arg" in - *.py|*::*) - pytest_args+=("$arg") - ;; - *.t) - prysk_args+=("$arg") - ;; - *) - # Flags or directories - add to both - pytest_args+=("$arg") - prysk_args+=("$arg") - ;; - esac - done -fi - -# Track overall exit status -exit_status=0 - -# Run pytest if we have args -if [ ${#pytest_args[@]} -gt 0 ]; then - uv run python -m pytest -v -p no:faulthandler "${pytest_args[@]}" - pytest_status=$? - if [ $pytest_status -ne 0 ]; then - exit_status=$pytest_status - fi -fi - -# Run prysk if we have args and prysk is installed -if [ ${#prysk_args[@]} -gt 0 ] && command -v prysk; then - # NB: We cannot add prysk to pyproject.toml because - # prysk depends on an incompatible version of rich. - # Use `uv tool install prysk` instead. - # - # We set COLOR=never by default to avoid ANSI codes in test output. - # We set NO_PROGRESS=1 to disable progress bars in test output. - # This is especially important for CI, which may or may not detect - # as ANSI-color-compatible compared to local usage of prysk. - # Tests can override this (e.g., color.t does). - COLOR="${COLOR:-never}" NO_PROGRESS="${NO_PROGRESS:-1}" prysk -v "${prysk_args[@]}" - prysk_status=$? - if [ $prysk_status -ne 0 ]; then - exit_status=$prysk_status - fi -fi - -# Exit with appropriate status -exit $exit_status +# COLOR/NO_PROGRESS defaults keep prysk (.t) test output clean of ANSI codes +# and progress bars. Individual tests can override (e.g. color.t sets its own +# COLOR). The -p no:faulthandler flag avoids spurious warnings on some platforms. +COLOR="${COLOR:-never}" NO_PROGRESS="${NO_PROGRESS:-1}" \ + uv run python -m pytest -v -p no:faulthandler "${@:-tests}" diff --git a/pyproject.toml b/pyproject.toml index 2820d8e..7eb6b8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,6 +58,7 @@ cli = [ dev = [ "build", "mypy", + "pytest-prysk", "pytest", "ruff", "types-Pygments", @@ -103,6 +104,10 @@ extend-ignore = ["E203"] # Ignore `E402` (import violations) in all `__init__.py` files, and in `path/to/file.py`. "__init__.py" = ["E402", "F401"] +[tool.uv] +# prysk>=0.15 declares rich<14, but rich 14 is compatible with prysk's usage. +override-dependencies = ["rich>=14.2.0"] + [tool.pytest.ini_options] filterwarnings = [ "ignore::DeprecationWarning", diff --git a/tests/cli/example.t b/tests/cli/example.t index 9f96df5..b2a1f29 100644 --- a/tests/cli/example.t +++ b/tests/cli/example.t @@ -7,7 +7,7 @@ GC shorthand (e.g., gc = "G1") must be normalized to -XX:+UseG1GC. Dotted property names (e.g., app.name = "foo" under [java.properties]) must be flattened to -Dapp.name=foo, not passed as -Dapp={'name': 'foo'}. - $ mkdir -p "$TMPDIR/jgo-example-test" && cd "$TMPDIR/jgo-example-test" + $ mkdir -p "jgo-example-test" && cd "jgo-example-test" $ cat > jgo.toml << 'EOF' > [environment] > name = "test-app" diff --git a/tests/cli/init.t b/tests/cli/init.t index cbac0a3..705aec9 100644 --- a/tests/cli/init.t +++ b/tests/cli/init.t @@ -26,7 +26,7 @@ Test bare init (no endpoint) creates an empty environment. $ jgo --dry-run init [DRY-RUN] Would create jgo.toml: - name = "init.t" + name = ".*" (re) coordinates = [] @@ -46,7 +46,7 @@ Test init with --dry-run. $ jgo --dry-run init org.python:jython-standalone:2.7.4 [DRY-RUN] Would create jgo.toml: - name = "init.t" + name = ".*" (re) description = "Generated from org.python:jython-standalone:2.7.4" @@ -76,7 +76,7 @@ Test init with -r requirements file (bare init). $ jgo --dry-run init -r reqs.txt [DRY-RUN] Would create jgo.toml: - name = "init.t" + name = ".*" (re) coordinates = [ @@ -93,7 +93,7 @@ Test init with -r requirements file and endpoint. $ jgo --dry-run init org.python:jython-standalone:2.7.4 -r reqs.txt [DRY-RUN] Would create jgo.toml: - name = "init.t" + name = ".*" (re) description = "Generated from org.python:jython-standalone:2.7.4"