Skip to content

Commit cfc7a67

Browse files
committed
fix: pilot-db tests
1 parent e12ced6 commit cfc7a67

2 files changed

Lines changed: 3 additions & 12 deletions

File tree

diracx-db/tests/pilots/test_pilot_management.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from datetime import datetime, timezone
44

55
import pytest
6-
import pytest_asyncio
76

87
from diracx.core.exceptions import (
98
PilotAlreadyAssociatedWithJobError,
@@ -17,7 +16,7 @@
1716
MAIN_VO = "lhcb"
1817

1918

20-
@pytest_asyncio.fixture
19+
@pytest.fixture
2120
async def pilot_db():
2221
agents_db = PilotAgentsDB("sqlite+aiosqlite:///:memory:")
2322
async with agents_db.engine_context():
@@ -26,7 +25,6 @@ async def pilot_db():
2625
yield agents_db
2726

2827

29-
@pytest.mark.asyncio
3028
async def test_register_pilots_roundtrip(pilot_db: PilotAgentsDB):
3129
"""Register a pilot and read it back with its defaults."""
3230
async with pilot_db as db:
@@ -47,7 +45,6 @@ async def test_register_pilots_roundtrip(pilot_db: PilotAgentsDB):
4745
assert not pilot["AccountingSent"]
4846

4947

50-
@pytest.mark.asyncio
5148
async def test_update_pilot_metadata_heterogeneous(pilot_db: PilotAgentsDB):
5249
"""A single call must support rows that set different field subsets.
5350
@@ -78,7 +75,6 @@ async def test_update_pilot_metadata_heterogeneous(pilot_db: PilotAgentsDB):
7875
assert rows["stamp-2"]["BenchMark"] == 42.0
7976

8077

81-
@pytest.mark.asyncio
8278
async def test_update_pilot_metadata_missing_pilot_raises(pilot_db: PilotAgentsDB):
8379
async with pilot_db as db:
8480
with pytest.raises(PilotNotFoundError):
@@ -87,7 +83,6 @@ async def test_update_pilot_metadata_missing_pilot_raises(pilot_db: PilotAgentsD
8783
)
8884

8985

90-
@pytest.mark.asyncio
9186
async def test_assign_jobs_to_pilot_duplicate_raises(pilot_db: PilotAgentsDB):
9287
"""Second assignment of the same (pilot, job) pair must raise."""
9388
async with pilot_db as db:
@@ -109,7 +104,6 @@ async def test_assign_jobs_to_pilot_duplicate_raises(pilot_db: PilotAgentsDB):
109104
)
110105

111106

112-
@pytest.mark.asyncio
113107
async def test_delete_cascades_logs_and_mappings(pilot_db: PilotAgentsDB):
114108
"""Deleting a pilot removes its logs and job associations."""
115109
async with pilot_db as db:

diracx-db/tests/pilots/test_query.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
import pytest
4-
import pytest_asyncio
54

65
from diracx.core.models.pilot import PilotMetadata, PilotStatus
76
from diracx.core.models.search import (
@@ -18,7 +17,7 @@
1817
N = 20
1918

2019

21-
@pytest_asyncio.fixture
20+
@pytest.fixture
2221
async def pilot_db():
2322
agents_db = PilotAgentsDB("sqlite+aiosqlite:///:memory:")
2423
async with agents_db.engine_context():
@@ -27,7 +26,7 @@ async def pilot_db():
2726
yield agents_db
2827

2928

30-
@pytest_asyncio.fixture
29+
@pytest.fixture
3130
async def populated_pilot_db(pilot_db):
3231
"""Small, focused dataset: N pilots with alternating statuses."""
3332
stamps = [f"stamp_{i + 1}" for i in range(N)]
@@ -51,7 +50,6 @@ async def populated_pilot_db(pilot_db):
5150
yield pilot_db
5251

5352

54-
@pytest.mark.asyncio
5553
async def test_search_smoke(populated_pilot_db):
5654
"""Smoke-test the generic search helpers through the pilots table.
5755
@@ -102,7 +100,6 @@ async def test_search_smoke(populated_pilot_db):
102100
assert [r["PilotID"] for r in result][0] == N
103101

104102

105-
@pytest.mark.asyncio
106103
async def test_pilot_summary_groups_by_status(populated_pilot_db):
107104
"""`pilot_summary` must aggregate by the requested column."""
108105
async with populated_pilot_db as db:

0 commit comments

Comments
 (0)