Skip to content

Commit

Permalink
Run pytest from venv on Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf committed Dec 11, 2024
1 parent f9cef6b commit b259fd0
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 38 deletions.
60 changes: 26 additions & 34 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,36 @@ permissions:
contents: read

jobs:
# go:
# name: Test Go
# strategy:
# matrix:
# runner: [macos-latest, ubuntu-latest, windows-latest]
# runs-on: ${{ matrix.runner }}
# steps:
# - uses: actions/checkout@v4
# - name: Setup Go
# uses: actions/setup-go@v5
# with:
# go-version: "1.23"
# check-latest: true
# cache: false
# - name: Install mage
# run: go install github.com/magefile/[email protected]
# - name: Run unit tests
# run: mage test:unit
go:
name: Test Go
strategy:
matrix:
runner: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
check-latest: true
cache: false
- name: Install mage
run: go install github.com/magefile/[email protected]
- name: Run unit tests
run: mage test:unit

python:
name: Test Python
strategy:
matrix:
runner: [macos-15]
python: ["3.10"]
runner: [macos-latest, ubuntu-latest, windows-latest]
python: ["3.9", "3.10", "3.11", "3.12"]
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- name: Install Conda
# if: matrix.runner == 'macos-latest'
if: matrix.runner == 'macos-latest'
run: |
curl -L -o miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
chmod +x miniconda.sh
Expand All @@ -62,16 +62,8 @@ jobs:
run: uv venv --python ${{ matrix.python }}
- name: Install our package in editable mode
run: uv sync --all-extras
- name: Build package
run: uv run -m mlflow_go.lib -- . .
- name: run pytest
run: .venv/bin/pytest -sv --debug --log-cli-level=DEBUG --confcutdir=. -k "not [file" .mlflow.repo/tests/tracking/test_model_registry.py ; echo $?
env:
MLFLOW_GO_LIBRARY_PATH: ${{ github.workspace }}
PYTHONLOGGING: DEBUG
continue-on-error: true
- name: cat debug
run: cat pytestdebug.log
# - name: Run integration tests
# run: mage test:python
# if: ${{ !(matrix.python == '3.12' && matrix.runner == 'windows-latest') }}
- name: Run integration tests
run: mage test:python
if: ${{ !(matrix.python == '3.12' && matrix.runner == 'windows-latest') }}
# Temporary workaround for failing tests
continue-on-error: ${{ matrix.runner == 'macos-latest' }}
15 changes: 11 additions & 4 deletions magefiles/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,22 @@ func runPythonTests(pytestArgs []string) error {
return nil
}

args := []string{
"run",
"pytest",
executable := "uv"
args := []string{"run", "pytest"}
if runtime.GOOS == "darwin" {

Check failure on line 32 in magefiles/tests.go

View workflow job for this annotation

GitHub Actions / lint / Lint

only one cuddle assignment allowed before if statement (wsl)
executable = ".venv/bin/pytest"
args = []string{}
}

fixedPytestArgs := []string{
// "-s",
"--log-cli-level=DEBUG",
"--confcutdir=.",
"-k", "not [file",
"-p", "no:warnings",
}

args = append(args, fixedPytestArgs...)
args = append(args, pytestArgs...)

environmentVariables := map[string]string{
Expand All @@ -49,7 +56,7 @@ func runPythonTests(pytestArgs []string) error {

// Run the tests (currently just the server ones)
if err := sh.RunWithV(environmentVariables,
"uv", args...,
executable, args...,
); err != nil {
return err
}
Expand Down

0 comments on commit b259fd0

Please sign in to comment.