Visitar URL original
Move test executions to Justfile by filmor · Pull Request #2746 · pythonnet/pythonnet · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 9 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ jobs:
- name: Checkout code
uses: actions/checkout@v7

- name: Setup just
uses: extractions/setup-just@v4

# Use main until support for architecture lands
- name: Setup .NET
uses: actions/setup-dotnet@main
Expand Down Expand Up @@ -85,23 +88,23 @@ jobs:

- name: Embedding tests (Mono/.NET Framework)
if: always()
run: dotnet test --runtime any-${{ matrix.os.platform }} --framework net472 --logger "console;verbosity=detailed" src/embed_tests/
run: just test-embed-mono ${{ matrix.os.platform }}

- name: Embedding tests (.NET Core)
if: always()
run: dotnet test --runtime any-${{ matrix.os.platform }} --framework net10.0 --logger "console;verbosity=detailed" src/embed_tests/
run: just test-embed-core ${{ matrix.os.platform }}

- name: Python Tests (.NET Core)
if: always()
run: pytest --runtime coreclr
run: just test-python-coreclr

- name: Python Tests (Mono)
if: always()
run: uv run pytest --runtime mono -v -o faulthandler_timeout=60
run: just test-python-mono

- name: Python Tests (.NET Framework)
if: ${{ matrix.os.category == 'windows' }}
run: pytest --runtime netfx
run: just test-python-netfx

- name: Python tests run from .NET
run: dotnet test --runtime any-${{ matrix.os.platform }} src/python_tests_runner/
run: just test-python-from-dotnet ${{ matrix.os.platform }}
7 changes: 5 additions & 2 deletions .github/workflows/nuget-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
- name: Checkout code
uses: actions/checkout@v7

- name: Setup just
uses: extractions/setup-just@v4

- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
Expand All @@ -44,10 +47,10 @@ jobs:
echo PYTHONNET_PYDLL=$(python -m find_libpython) >> $GITHUB_ENV

- name: Python Tests
run: pytest
run: just test-python

- name: Embedding tests
run: dotnet test --runtime any-ubuntu src/embed_tests/
run: just test-embed any-ubuntu

- name: Pack
run: dotnet pack --configuration Release --version-suffix preview${{env.DATE_VER}} --output "Release-Preview"
Expand Down
40 changes: 39 additions & 1 deletion Justfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
default:
@just --choose

default_platform := if arch() == "x86_64" { "x64" } else if arch() == "aarch64" { "arm64" } else { arch() }

setup:
dotnet restore
uv sync
Expand All @@ -11,4 +13,40 @@ docs:

build-wheels:
uv build
uv build --wheel -C="--global-option=--net46-support"
uv build --wheel -C="--global-option=--net46-support"

# Run default tests (.NET Core Python and embedding tests)
test: test-python-coreclr test-embed-core

# Run Python tests (default or pass options like --runtime coreclr)
test-python *args:
uv run pytest {{ args }}

# Run Python tests with .NET Core
test-python-coreclr *args:
uv run pytest --runtime coreclr {{ args }}

# Run Python tests with Mono
test-python-mono *args:
uv run pytest --runtime mono {{ args }}

# Run Python tests with .NET Framework
test-python-netfx *args:
uv run pytest --runtime netfx {{ args }}

# Run Python tests executed via .NET test runner
test-python-from-dotnet platform=default_platform *args:
dotnet test --runtime any-{{ platform }} src/python_tests_runner/ {{ args }}

# Run embedding tests
test-embed runtime=("any-" + default_platform) *args:
dotnet test --runtime {{ runtime }} src/embed_tests/ {{ args }}

# Run embedding tests with .NET Core
test-embed-core platform=default_platform *args:
dotnet test --runtime any-{{ platform }} --framework net10.0 --logger "console;verbosity=detailed" src/embed_tests/ {{ args }}

# Run embedding tests with Mono / .NET Framework
[env("MONO_THREADS_SUSPEND", "preemptive")]
test-embed-mono platform=default_platform *args:
dotnet test --runtime any-{{ platform }} --framework net472 --logger "console;verbosity=detailed" src/embed_tests/ {{ args }}
Loading