From 9d4110342312598b7f62d87d29faa04015cfff43 Mon Sep 17 00:00:00 2001 From: Andrii Ieroshenko Date: Thu, 9 May 2024 13:45:53 -0700 Subject: [PATCH] fix pytest tests --- jupyter_scheduler/tests/mocks.py | 4 +++- jupyter_scheduler/tests/test_execution_manager.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/jupyter_scheduler/tests/mocks.py b/jupyter_scheduler/tests/mocks.py index 317e7523..304915dd 100644 --- a/jupyter_scheduler/tests/mocks.py +++ b/jupyter_scheduler/tests/mocks.py @@ -1,4 +1,6 @@ +from multiprocessing import Queue from typing import Dict, List +from unittest.mock import Mock from jupyter_scheduler.download_manager import DownloadManager from jupyter_scheduler.environments import EnvironmentManager @@ -78,4 +80,4 @@ def resume_jobs(self, job_definition_id: str): class MockDownloadManager(DownloadManager): def __init__(self, db_url: str): - pass + self.queue = Queue() diff --git a/jupyter_scheduler/tests/test_execution_manager.py b/jupyter_scheduler/tests/test_execution_manager.py index a9393eb9..fad3f3fe 100644 --- a/jupyter_scheduler/tests/test_execution_manager.py +++ b/jupyter_scheduler/tests/test_execution_manager.py @@ -7,6 +7,7 @@ from conftest import DB_URL from jupyter_scheduler.executors import DefaultExecutionManager from jupyter_scheduler.orm import Job +from jupyter_scheduler.tests.mocks import MockDownloadManager JOB_ID = "69856f4e-ce94-45fd-8f60-3a587457fce7" NOTEBOOK_NAME = "side_effects.ipynb" @@ -30,11 +31,13 @@ def load_job(jp_scheduler_db): def test_add_side_effects_files(jp_scheduler_db, load_job): + download_manager = MockDownloadManager(DB_URL) manager = DefaultExecutionManager( job_id=JOB_ID, root_dir=str(NOTEBOOK_DIR), db_url=DB_URL, staging_paths={"input": str(NOTEBOOK_PATH)}, + download_queue=download_manager.queue, ) manager.add_side_effects_files(str(NOTEBOOK_DIR))