Skip to content

Commit 10547b8

Browse files
authored
Tests pass against both Datasette <1.0 and Datasette >1.0a20 (#79)
Update test to handle both versions, closes #78
1 parent 68f2adc commit 10547b8

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
strategy:
1212
matrix:
1313
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
14+
datasette-version: ["<1.0", ">=1.0a20"]
1415
steps:
1516
- uses: actions/checkout@v4
1617
- name: Set up Python ${{ matrix.python-version }}
@@ -22,6 +23,7 @@ jobs:
2223
- name: Install dependencies
2324
run: |
2425
pip install '.[test]'
26+
pip install "datasette${{ matrix.datasette-version }}"
2527
- name: Run tests
2628
run: |
2729
python -m pytest

Justfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
set positional-arguments
2+
3+
test *args:
4+
uv run --isolated --with 'datasette<1.0' --with-editable '.[test]' -- python -m pytest
5+
uv run --isolated --with 'datasette>=1.0a20' --with-editable '.[test]' -- python -m pytest

tests/test_datasette_auth_github.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,11 @@ async def test_database_access_permissions(
197197
)
198198
cookies = {"ds_actor": auth_response.cookies["ds_actor"]}
199199
databases = await ds.client.get("/.json", cookies=cookies)
200-
assert set(databases.json()["databases"].keys()) == expected_databases
200+
# This differs between Datasette <1.0 and >=1.0a20
201+
if "databases" in databases.json():
202+
assert set(databases.json()["databases"].keys()) == expected_databases
203+
else:
204+
assert set(databases.json().keys()) == expected_databases
201205

202206

203207
@pytest.mark.asyncio

0 commit comments

Comments
 (0)