Skip to content

Commit d26c9ba

Browse files
committed
ci: fix fallback library jobs and add baikal integration tests
niquests is the default (not a fallback): async falls back to httpx, sync falls back to requests. The old async-niquests job was testing the default path (already covered by the main matrix job) and not the httpx fallback. - Rename async-niquests → async-httpx; uninstall niquests so httpx is used; assert _USE_HTTPX in the verify step - Add Baikal service + setup to both fallback jobs so integration tests run against a real server, not just unit/Radicale tests - sync-requests: extend -k filter to "Baikal or Radicale" and pass BAIKAL_URL prompt: There is no "niquests fallback" - niquests is the default library now, with httpx as a fallback in async. So we need 1) test code to ensure the httpx fallback works in async mode, 2) test code to ensure the requests fallback works in sync mode. We should run both sync tests and async tests towards the baikal server using niquests at github. AI Prompts: claude-sonnet-4-6: There is no "niquests fallback" - niquests is the default library now, with httpx as a fallback in async. So we need ... 1) test code to ensure the httpx fallback works in async mode, 2) test code to ensure the requests fallback works in sync mode. We should run both sync tests and async tests towards the baikal server using niquests at github.
1 parent fd648e7 commit d26c9ba

1 file changed

Lines changed: 39 additions & 11 deletions

File tree

.github/workflows/tests.yaml

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,9 @@ jobs:
334334
key: pip|${{ hashFiles('setup.py') }}|${{ hashFiles('tox.ini') }}
335335
- run: pip install tox
336336
- run: tox -e deptry
337-
async-niquests:
338-
# Test that async code works with niquests when httpx is not installed
339-
name: async (niquests fallback)
337+
async-httpx:
338+
# Test that async code works with httpx when niquests is not installed
339+
name: async (httpx fallback)
340340
runs-on: ubuntu-latest
341341
services:
342342
baikal:
@@ -354,10 +354,10 @@ jobs:
354354
- uses: actions/setup-python@v5
355355
with:
356356
python-version: "3.12"
357-
- name: Install dependencies without httpx
357+
- name: Install dependencies without niquests
358358
run: |
359359
pip install --editable .[test]
360-
pip uninstall -y httpx
360+
pip uninstall -y niquests
361361
- name: Configure Baikal with pre-seeded database
362362
run: |
363363
docker cp tests/docker-test-servers/baikal/Specific/. ${{ job.services.baikal.id }}:/var/www/baikal/Specific/
@@ -373,22 +373,33 @@ jobs:
373373
echo "✗ Error: Baikal did not become ready within 60 seconds"
374374
exit 1
375375
fi
376-
- name: Verify niquests is used
376+
- name: Verify httpx is used
377377
run: |
378378
python -c "
379379
from caldav.async_davclient import _USE_HTTPX, _USE_NIQUESTS
380-
assert not _USE_HTTPX, 'httpx should not be available'
381-
assert _USE_NIQUESTS, 'niquests should be used'
382-
print('✓ Using niquests for async HTTP')
380+
assert _USE_HTTPX, 'httpx should be available'
381+
assert not _USE_NIQUESTS, 'niquests should not be available'
382+
print('✓ Using httpx for async HTTP')
383383
"
384-
- name: Run async tests with niquests
384+
- name: Run async tests with httpx
385385
run: pytest tests/test_async_davclient.py tests/test_async_integration.py -v -k baikal
386386
env:
387387
BAIKAL_URL: http://localhost:8800
388388
sync-requests:
389389
# Test that sync code works with requests when niquests is not installed
390390
name: sync (requests fallback)
391391
runs-on: ubuntu-latest
392+
services:
393+
baikal:
394+
image: ckulka/baikal:nginx
395+
ports:
396+
- 8800:80
397+
options: >-
398+
--health-cmd "curl -f http://localhost/ || exit 1"
399+
--health-interval 10s
400+
--health-timeout 5s
401+
--health-retries 5
402+
--health-start-period 30s
392403
steps:
393404
- uses: actions/checkout@v4
394405
- uses: actions/setup-python@v5
@@ -399,6 +410,21 @@ jobs:
399410
pip install --editable .[test]
400411
pip uninstall -y niquests
401412
pip install requests
413+
- name: Configure Baikal with pre-seeded database
414+
run: |
415+
docker cp tests/docker-test-servers/baikal/Specific/. ${{ job.services.baikal.id }}:/var/www/baikal/Specific/
416+
docker cp tests/docker-test-servers/baikal/config/. ${{ job.services.baikal.id }}:/var/www/baikal/config/
417+
docker exec ${{ job.services.baikal.id }} chown -R nginx:nginx /var/www/baikal/Specific /var/www/baikal/config
418+
docker exec ${{ job.services.baikal.id }} chmod -R 770 /var/www/baikal/Specific
419+
docker restart ${{ job.services.baikal.id }}
420+
- name: Wait for Baikal to be ready
421+
run: |
422+
if timeout 60 bash -c 'until curl -f http://localhost:8800/ 2>/dev/null; do echo "Waiting..."; sleep 2; done'; then
423+
echo "✓ Baikal is ready!"
424+
else
425+
echo "✗ Error: Baikal did not become ready within 60 seconds"
426+
exit 1
427+
fi
402428
- name: Verify requests is used
403429
run: |
404430
python -c "
@@ -408,4 +434,6 @@ jobs:
408434
print('✓ Using requests for sync HTTP')
409435
"
410436
- name: Run sync tests with requests
411-
run: pytest tests/test_caldav.py -v -k "Radicale" --ignore=tests/test_async_integration.py
437+
run: pytest tests/test_caldav.py -v -k "Baikal or Radicale" --ignore=tests/test_async_integration.py
438+
env:
439+
BAIKAL_URL: http://localhost:8800

0 commit comments

Comments
 (0)