Skip to content

Commit 84ec9a6

Browse files
committed
test: add test to ensure mdbtools is installed
1 parent 34a27ac commit 84ec9a6

2 files changed

Lines changed: 32 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
matrix:
1818
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
1919
python-version: ["3.11", "3.12", "3.13"]
20+
polars-version: ["0.20", "1.20", "1.30", "1.31"]
2021
include:
2122
# Methodology: Use Ubuntu for basically everything, then target
2223
# specific cases for the OSes and Python versions.
@@ -50,7 +51,7 @@ jobs:
5051
- name: Set up Python
5152
run: uv python install
5253

53-
- name: Install uv dependencies
54+
- name: Install uv dependencies (Linux/macOS)
5455
if: runner.os == 'Linux' || runner.os == 'macOS'
5556
run: |
5657
if [ -n "${{ matrix.polars-version || '' }}" ]; then
@@ -62,6 +63,7 @@ jobs:
6263
fi
6364
- name: Install uv dependencies (Windows)
6465
if: runner.os == 'Windows'
66+
shell: pwsh
6567
run: |
6668
if ($env:MATRIX_POLARS_VERSION) {
6769
Write-Host "Overriding Polars version to $env:MATRIX_POLARS_VERSION"
@@ -70,10 +72,10 @@ jobs:
7072
} else {
7173
uv sync --all-extras
7274
}
73-
shell: pwsh
7475
7576
- name: Run linting
7677
run: |
78+
uv run python -c "import polars ; polars.show_versions()"
7779
uv run ruff format --check .
7880
uv run ruff check .
7981
@@ -117,5 +119,9 @@ jobs:
117119
Write-Host "Extracted to $extractPath"
118120
shell: pwsh
119121

122+
- name: Verify MDBTools installation
123+
run: |
124+
mdb-ver --version
125+
120126
- name: Run tests
121127
run: uv run pytest tests/

tests/test_mdbtools_installed.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""Test to ensure mdbtools is installed and accessible."""
2+
3+
import subprocess
4+
5+
import pytest
6+
7+
8+
def test_mdbtools_installed() -> None:
9+
"""Test that mdbtools commands are accessible."""
10+
try:
11+
result = subprocess.run(
12+
["mdb-ver", "--version"], # noqa: S607
13+
capture_output=True,
14+
text=True,
15+
check=True,
16+
)
17+
output = result.stdout.strip()
18+
assert "mdbtools" in output, (
19+
"mdb-ver output does not indicate MDB Tools is installed."
20+
)
21+
except FileNotFoundError:
22+
pytest.fail("mdb-ver command not found. MDB Tools may not be installed.")
23+
except subprocess.CalledProcessError as e:
24+
pytest.fail(f"mdb-ver command failed with error: {e.stderr.strip()}")

0 commit comments

Comments
 (0)