From 7b775f4fb3614b3acb8190dc7eae737b76bd40b5 Mon Sep 17 00:00:00 2001 From: Nicolas Frank Date: Wed, 30 Oct 2024 14:28:50 +0100 Subject: [PATCH] Fix tests --- tests/app/test_retrieval.py | 4 ++-- tests/scripts/test_parse_and_upload.py | 1 + tests/scripts/test_pmc_parse_and_upload.py | 1 + tests/test_retrieve_metadata.py | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/app/test_retrieval.py b/tests/app/test_retrieval.py index db551fe..04f26e0 100644 --- a/tests/app/test_retrieval.py +++ b/tests/app/test_retrieval.py @@ -190,10 +190,10 @@ async def test_article_count( @pytest.mark.asyncio -async def test_article_listing(get_testing_async_ds_client, request): +@pytest.mark.httpx_mock(can_send_already_matched_responses=True) +async def test_article_listing(get_testing_async_ds_client, mock_http_calls): ds_client, parameters = get_testing_async_ds_client - request.getfixturevalue("mock_http_calls") test_settings = Settings( db={ "db_type": ( diff --git a/tests/scripts/test_parse_and_upload.py b/tests/scripts/test_parse_and_upload.py index 08b5912..7a0bc63 100644 --- a/tests/scripts/test_parse_and_upload.py +++ b/tests/scripts/test_parse_and_upload.py @@ -140,6 +140,7 @@ async def fake_close(self): @pytest.mark.asyncio +@pytest.mark.httpx_mock(can_send_already_matched_responses=True) @patch("scholarag.document_stores.AsyncOpenSearch.close", new=fake_close) async def test_run_with_es_instance(tmp_path, httpx_mock, get_testing_async_ds_client): ds_client, parameters = get_testing_async_ds_client diff --git a/tests/scripts/test_pmc_parse_and_upload.py b/tests/scripts/test_pmc_parse_and_upload.py index eac6f12..2e903ad 100644 --- a/tests/scripts/test_pmc_parse_and_upload.py +++ b/tests/scripts/test_pmc_parse_and_upload.py @@ -10,6 +10,7 @@ @pytest.mark.asyncio +@pytest.mark.httpx_mock(can_send_already_matched_responses=True) async def test_pmc_parse_and_upload(httpx_mock, get_testing_async_ds_client): ds_client, parameters = get_testing_async_ds_client index = "paragraphs_parse_script_pytest" diff --git a/tests/test_retrieve_metadata.py b/tests/test_retrieve_metadata.py index 4e3a55e..bd78692 100644 --- a/tests/test_retrieve_metadata.py +++ b/tests/test_retrieve_metadata.py @@ -500,6 +500,7 @@ async def test_metadata_retriever_recreate_abstract_with_db( @pytest.mark.parametrize( ["issn", "name"], [("1234-5678", "great_journal"), ("3426-1936", "bad_journal")] ) +@pytest.mark.httpx_mock(can_send_already_matched_responses=True) async def test_get_journal_name(httpx_mock, issn, name): # If ISSN is None async with httpx.AsyncClient() as client: