From ea524149b9858f6f66ec005b2ac36f0a76d79715 Mon Sep 17 00:00:00 2001 From: jannisborn Date: Tue, 2 Jul 2024 23:31:58 +0200 Subject: [PATCH] test: dump creation --- paperscraper/tests/test_dump.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/paperscraper/tests/test_dump.py b/paperscraper/tests/test_dump.py index 45db8aa..4bc662e 100644 --- a/paperscraper/tests/test_dump.py +++ b/paperscraper/tests/test_dump.py @@ -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(): @@ -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")