Skip to content

[MRG] MAINT use FutureWarning for deprecations #3007

[MRG] MAINT use FutureWarning for deprecations

[MRG] MAINT use FutureWarning for deprecations #3007

name: Windows Unit Tests
on:
push:
branches: ['**']
pull_request:
branches: ['**']
env:
PYTHONPATH: C:\nrn_test\lib\python
NEURONHOME: C:\nrn_test
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
python-version: [3.9, 3.11, 3.13]
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: test
python-version: ${{ matrix.python-version }}
- name: Update pip
shell: cmd
run: |
python -m pip install --upgrade pip
- name: Install ruff for use before ANY other tests
shell: cmd
run: |
pip install --verbose "ruff<0.16.0"
- name: Check ruff formatting
shell: cmd
run: |
ruff format hnn_core --check
- name: Lint with ruff
shell: cmd
run: |
ruff check hnn_core
- name: Install Neuron on Windows separately
shell: cmd
run: |
powershell -command "gh release download 8.2.7 --repo https://github.com/neuronsimulator/nrn --pattern '*.exe' --output nrn-setup.exe"
start /b /wait .\nrn-setup.exe /S /D=C:\nrn_test
powershell -command "'C:\nrn_test\bin' >> $env:GITHUB_PATH"
python -c "import neuron"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install HNN-Core with minimal dependencies
shell: cmd
run: |
pip install --verbose .
- name: Test API with minimal dependencies
shell: cmd
run: |
python -c "from hnn_core import neymotin_2020_model, simulate_dipole; simulate_dipole(neymotin_2020_model(), tstop=20); print('--> SUCCESS: The test worked!')"
- name: Clean minimal dependencies install
shell: cmd
run: rmdir /s /q build
- name: Install HNN-Core with Optimization dependencies
shell: cmd
run: pip install --verbose .[opt]
- name: Test Optimization dependencies
shell: cmd
run: python -c "from hnn_core.optimization import Optimizer"
- name: Clean Optimization dependencies install
shell: cmd
run: rmdir /s /q build
- name: Install HNN-Core with GUI dependencies
shell: cmd
run: pip install --verbose .[gui]
- name: Test GUI dependencies
shell: powershell
run: |
$outFile = "$env:TEMP\voila_out.log"
$errFile = "$env:TEMP\voila_err.log"
$proc = Start-Process -FilePath "hnn-gui" -ArgumentList "--no-browser" `
-RedirectStandardOutput $outFile -RedirectStandardError $errFile `
-PassThru -NoNewWindow
$success = $false
# Poll until voila server responds (timeout ~60 seconds (30 * sleep 2)
for ($i = 0; $i -lt 30; $i++) {
$content = ""
if (Test-Path $outFile) { $content += (Get-Content $outFile -Raw -ErrorAction SilentlyContinue) }
if (Test-Path $errFile) { $content += (Get-Content $errFile -Raw -ErrorAction SilentlyContinue) }
if ($content -match "is running at") {
$success = $true
break
}
Start-Sleep -Seconds 2
}
Stop-Process -Id $proc.Id -Force -ErrorAction SilentlyContinue
if ($success) {
Write-Output "--> SUCCESS: GUI launched successfully"
} else {
Write-Output "--> FAILURE: GUI did not launch within 60 seconds"
if (Test-Path $outFile) { Get-Content $outFile }
if (Test-Path $errFile) { Get-Content $errFile }
exit 1
}
- name: Clean GUI dependencies install
shell: cmd
run: rmdir /s /q build
- name: Install HNN-Core with full dependencies
shell: cmd
run: |
pip install --verbose .[opt,parallel,test,gui]
- name: Test non-MPI, embarrassingly parallel tests with pytest
shell: cmd
run: |
python -m pytest ./hnn_core/tests/ -m "not uses_mpi" -n auto --cov=hnn_core --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage.xml