Skip to content

Commit

Permalink
test: dump creation
Browse files Browse the repository at this point in the history
  • Loading branch information
jannisborn committed Jul 2, 2024
1 parent 0acb8e0 commit ea52414
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions paperscraper/tests/test_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ def setup_biorxiv(self):
def setup_chemrxiv(self):
return chemrxiv

@pytest.fixture
def setup_chemrxiv_date(self):
return lambda: chemrxiv(begin_date="2024-06-01", end_date="2024-06-02")

@pytest.fixture
def setup_biorxiv_date(self):
return lambda: biorxiv(begin_date="2024-06-01", end_date="2024-06-02")

def run_function_with_timeout(self, func, timeout):
# Define the target function for the thread
def target():
Expand Down Expand Up @@ -66,6 +58,19 @@ def test_biorxiv(self, setup_biorxiv):
setup_biorxiv, 15
), "biorxiv should still be running after 15 seconds"

@pytest.mark.timeout(30)
def test_chemrxiv(self, setup_chemrxiv):
# Check that the function runs for at least 15 seconds
assert self.run_function_with_timeout(
setup_chemrxiv, 15
), "chemrxiv should still be running after 15 seconds"

def test_chemrxiv_date(self):
chemrxiv(begin_date="2024-06-01", end_date="2024-06-02")

def test_biorxiv_date(self):
biorxiv(begin_date="2024-06-01", end_date="2024-06-02")

def test_dumping(self):
queries = [[covid19, ai, mi]]
dump_queries(queries, "tmpdir")
Expand Down

0 comments on commit ea52414

Please sign in to comment.