about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPjotr Prins2026-04-05 11:43:35 +0200
committerPjotr Prins2026-04-05 11:43:35 +0200
commitdbfeccada1550cfcfbedb9e92d3b13ccbf0e547f (patch)
tree4ca11a0c443d5f8f429c248e5aa03b56b5b5805a
parent433e5670464565948ead89097190b303168e27f0 (diff)
downloadgenecup-dbfeccada1550cfcfbedb9e92d3b13ccbf0e547f.tar.gz
Added test for esearch
-rw-r--r--VERSION2
-rw-r--r--guix.scm3
-rw-r--r--tests/test_network_esearch.py24
3 files changed, 27 insertions, 2 deletions
diff --git a/VERSION b/VERSION
index 2e0e38c..c064b1b 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.9
+1.9.1-pre
diff --git a/guix.scm b/guix.scm
index 905f1ac..b27bc8c 100644
--- a/guix.scm
+++ b/guix.scm
@@ -364,7 +364,8 @@ access to Gemini models.")
                   (("\\./minipubmed") pubmed)))))
           (replace 'check
             (lambda _
-              (invoke "python" "-m" "unittest" "discover" "-s" "tests" "-v")))
+              ;; test_network_* files need internet, skip them
+              (invoke "python" "-m" "unittest" "tests.test_hello" "-v")))
           (replace 'install
             (lambda* (#:key outputs #:allow-other-keys)
               (let ((out (assoc-ref outputs "out")))
diff --git a/tests/test_network_esearch.py b/tests/test_network_esearch.py
new file mode 100644
index 0000000..069f442
--- /dev/null
+++ b/tests/test_network_esearch.py
@@ -0,0 +1,24 @@
+"""Test PubMed esearch via edirect -- requires internet access.
+
+Run with: python -m unittest tests.test_network_esearch -v
+"""
+
+import subprocess
+import unittest
+
+class TestNetworkEsearch(unittest.TestCase):
+    def test_esearch_penk_stress(self):
+        """Search PubMed for Penk + stress, expect at least some PMIDs."""
+        result = subprocess.run(
+            ["sh", "-c",
+             'esearch -db pubmed -query "(stress) AND (Penk [tiab])" '
+             '| efetch -format uid'],
+            capture_output=True, text=True, timeout=60)
+        self.assertEqual(result.returncode, 0, result.stderr)
+        pmids = result.stdout.strip().split("\n")
+        pmids = [p for p in pmids if p.strip()]
+        print(f"  Found {len(pmids)} PMIDs for Penk+stress")
+        self.assertGreater(len(pmids), 0, "Expected at least 1 PMID")
+
+if __name__ == "__main__":
+    unittest.main()