[Debichem-devel] Bug#1107280: pymatgen: FTBFS: Tries to access Internet during build

Santiago Vila sanvila at debian.org
Thu Jun 5 10:48:02 BST 2025


Hi. I found a different mode of failure today:

=================================== FAILURES ===================================
______________________ TestVaspDoc.test_print_help[ISYM] _______________________

self = <vasp.test_help.TestVaspDoc object at 0x7f34bfc4cb90>, tag = 'ISYM'

     @pytest.mark.parametrize("tag", ["ISYM"])
     def test_print_help(self, tag):
         vasp_doc = VaspDoc()
         with patch("sys.stdout", new=io.StringIO()) as fake_stdout:
>           vasp_doc.print_help(tag)

.pybuild/test_python3.13/tests/io/vasp/test_help.py:26:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.pybuild/test_python3.13/pymatgen/io/vasp/help.py:32: in print_help
     print(self.get_help(tag))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class 'pymatgen.io.vasp.help.VaspDoc'>, tag = 'ISYM', fmt = 'text'

     @classmethod
     def get_help(cls, tag: str, fmt: str = "text") -> str:
         """Get help on a VASP tag.
     
         Args:
             tag (str): VASP tag, e.g. ISYM.
     
         Returns:
             Help text.
         """
         tag = tag.upper()
         response = requests.get(
             f"https://www.vasp.at/wiki/index.php/{tag}",
             timeout=60,
         )
         soup = BeautifulSoup(response.text, features="html.parser")
         main_doc = soup.find(id="mw-content-text")
         if fmt == "text":
>           output = main_doc.text
E           AttributeError: 'NoneType' object has no attribute 'text'
---------------------------------------------------------------------

However, this also comes from tests/io/vasp/test_help.py, so
hardcoding website_down to True would also fix this one.

I'm attaching the trivial patch here, but someone should still
determine if it's good enough for the package as a whole
(i.e. considering also the CI tests).

Thanks.
-------------- next part --------------
--- a/tests/io/vasp/test_help.py
+++ b/tests/io/vasp/test_help.py
@@ -11,10 +11,7 @@ from pymatgen.io.vasp.help import VaspDoc
 BeautifulSoup = pytest.importorskip("bs4").BeautifulSoup
 
 
-try:
-    website_down = requests.get("https://www.vasp.at", timeout=5).status_code != 200
-except (requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout):
-    website_down = True
+website_down = True
 
 
 @pytest.mark.skipif(website_down, reason="www.vasp.at is down")


More information about the Debichem-devel mailing list