Skip to content

Commit 2296ff8

Browse files
committed
fix main test
1 parent 04b66ce commit 2296ff8

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

‎tests/integration/conftest.py‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,11 @@ def db_session(db: Database) -> Generator[Session, None, None]:
287287

288288

289289
@pytest.fixture
290-
def jobs(
290+
def job_defs(
291291
test_username: str,
292292
test_user_email: str,
293293
application: dict[str, str],
294294
job_attrs: dict[str, Any],
295-
db_session: Session,
296295
) -> list[Job]:
297296
job1 = Job(
298297
id=42,
@@ -316,10 +315,14 @@ def jobs(
316315
hardware={},
317316
paths_out={"output": "out", "log": "log", "artifact": "model"},
318317
)
319-
for job in [job1, job2]:
318+
return [job1, job2]
319+
320+
321+
def jobs(job_defs: list[Job], db_session: Session) -> list[Job]:
322+
for job in job_defs:
320323
db_session.add(job)
321324
db_session.commit()
322-
return [job1, job2]
325+
return job_defs
323326

324327

325328
@pytest.fixture

‎tests/integration/test_main.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def get_backup_nrows(self, s3_testing_bucket: S3TestingBucket) -> int:
5757
def test_sqlite_backup(
5858
self,
5959
db: SqliteDatabase,
60-
jobs: list[Job],
60+
job_defs: list[Job],
6161
client: TestClient,
6262
s3_testing_bucket: S3TestingBucket,
6363
tmpdir_factory: pytest.TempdirFactory,
@@ -75,14 +75,14 @@ def test_sqlite_backup(
7575

7676
# Enqueue a job and verify it's backed up
7777
with Session(db.engine) as session:
78-
session.add(jobs[0])
78+
session.add(job_defs[0])
7979
session.commit()
8080
time.sleep(2) # wait for backup to run
8181
assert self.get_backup_nrows(s3_testing_bucket) == 1
8282

8383
# Enqueue a second job and shutdown before backup runs
8484
with Session(db.engine) as session:
85-
session.add(jobs[1])
85+
session.add(job_defs[1])
8686
session.commit()
8787

8888
# On shutdown, final backup should run with both jobs

0 commit comments

Comments
 (0)