Skip to content

Commit

Permalink
fix: reload QUREY_FN_DICT
Browse files Browse the repository at this point in the history
  • Loading branch information
jannisborn committed Jul 2, 2024
1 parent ea52414 commit 0ba6be3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions paperscraper/tests/test_dump.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import importlib
import os
import threading

Expand All @@ -7,6 +8,9 @@
from paperscraper import dump_queries
from paperscraper.arxiv import get_and_dump_arxiv_papers
from paperscraper.get_dumps import biorxiv, chemrxiv, medrxiv
from paperscraper.load_dumps import QUERY_FN_DICT
import paperscraper.load_dumps as load_dumps_module


logging.disable(logging.INFO)

Expand All @@ -16,6 +20,12 @@


class TestDumper:

def test_dump_existence_initial(self):
# This test checks the initial state, should be run first if order matters
assert len(QUERY_FN_DICT) == 2, "Initial length of QUERY_FN_DICT should be 2"


@pytest.fixture
def setup_medrxiv(self):
return medrxiv
Expand Down Expand Up @@ -82,6 +92,6 @@ def test_arxiv_dumping(self):
assert os.path.exists("covid19_ai_imaging.jsonl")

def test_dump_existence(self):
importlib.reload(load_dumps_module)
from paperscraper.load_dumps import QUERY_FN_DICT

assert len(QUERY_FN_DICT) > 2
assert len(QUERY_FN_DICT) > 2, "Expected QUERY_FN_DICT to be updated by previous tests"

0 comments on commit 0ba6be3

Please sign in to comment.