Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

10 tests error out because they fail to find some files #4172

Open
yurivict opened this issue Nov 14, 2024 · 1 comment
Open

10 tests error out because they fail to find some files #4172

yurivict opened this issue Nov 14, 2024 · 1 comment
Labels

Comments

@yurivict
Copy link

yurivict commented Nov 14, 2024

Python version

Python-3.11

Pymatgen version

2024.11.13

Operating system version

FreeBSD 14.1

Current behavior

========================================================================================== ERRORS ===========================================================================================
___________________________________________________________ ERROR collecting tests/analysis/ferroelectricity/test_polarization.py ___________________________________________________________
analysis/ferroelectricity/test_polarization.py:23: in <module>
    structures = [Structure.from_file(f"{TEST_DIR}/{folder}/POSCAR") for folder in bto_folders]
analysis/ferroelectricity/test_polarization.py:23: in <listcomp>
    structures = [Structure.from_file(f"{TEST_DIR}/{folder}/POSCAR") for folder in bto_folders]
../../stage/usr/local/lib/python3.11/site-packages/pymatgen/core/structure.py:3175: in from_file
    with zopen(filename, mode="rt", errors="replace") as file:
/usr/local/lib/python3.11/site-packages/monty/io.py:50: in zopen
    return open(filename, *args, **kwargs)
E   FileNotFoundError: [Errno 2] No such file or directory: '/usr/ports/science/py-pymatgen/work-py311/stage/usr/local/lib/python3.11/site-packages/../tests/files/io/vasp/fixtures/BTO_221_99_polarization/nonpolar_polarization/POSCAR'
___________________________________________________________________ ERROR collecting tests/analysis/xas/test_spectrum.py ____________________________________________________________________
analysis/xas/test_spectrum.py:17: in <module>
    with open(f"{TEST_DIR}/LiCoO2_k_xanes.json") as file:
E   FileNotFoundError: [Errno 2] No such file or directory: '/usr/ports/science/py-pymatgen/work-py311/stage/usr/local/lib/python3.11/site-packages/../tests/files/analysis/spectrum_test/LiCoO2_k_xanes.json'
__________________________________________________________________ ERROR collecting tests/entries/test_computed_entries.py __________________________________________________________________
entries/test_computed_entries.py:29: in <module>
    vasp_run = Vasprun(f"{VASP_OUT_DIR}/vasprun.xml.gz")
../../stage/usr/local/lib/python3.11/site-packages/pymatgen/io/vasp/outputs.py:312: in __init__
    with zopen(filename, mode="rt") as file:
/usr/local/lib/python3.11/site-packages/monty/io.py:47: in zopen
    return gzip.open(filename, *args, **kwargs)
/usr/local/lib/python3.11/gzip.py:58: in open
    binary_file = GzipFile(filename, gz_mode, compresslevel)
/usr/local/lib/python3.11/gzip.py:174: in __init__
    fileobj = self.myfileobj = builtins.open(filename, mode or 'rb')
E   FileNotFoundError: [Errno 2] No such file or directory: '/usr/ports/science/py-pymatgen/work-py311/stage/usr/local/lib/python3.11/site-packages/../tests/files/io/vasp/outputs/vasprun.xml.gz'
______________________________________________________________________ ERROR collecting tests/io/feff/test_outputs.py _______________________________________________________________________
io/feff/test_outputs.py:11: in <module>
    class TestFeffLdos(TestCase):
io/feff/test_outputs.py:14: in TestFeffLdos
    ldos = LDos.from_file(filepath1, filepath2)
../../stage/usr/local/lib/python3.11/site-packages/pymatgen/io/feff/outputs.py:59: in from_file
    header_str = Header.header_string_from_file(feff_inp_file)
../../stage/usr/local/lib/python3.11/site-packages/pymatgen/io/feff/inputs.py:249: in header_string_from_file
    with zopen(filename, mode="r") as file:
/usr/local/lib/python3.11/site-packages/monty/io.py:50: in zopen
    return open(filename, *args, **kwargs)
E   FileNotFoundError: [Errno 2] No such file or directory: '/usr/ports/science/py-pymatgen/work-py311/stage/usr/local/lib/python3.11/site-packages/../tests/files/io/feff/feff.inp'
______________________________________________________________________ ERROR collecting tests/io/qchem/test_outputs.py ______________________________________________________________________
io/qchem/test_outputs.py:37: in <module>
    SINGLE_JOB_DICT = loadfn(f"{TEST_DIR}/single_job.json")
/usr/local/lib/python3.11/site-packages/monty/serialization.py:70: in loadfn
    with zopen(fn, "rt") as fp:
/usr/local/lib/python3.11/site-packages/monty/io.py:50: in zopen
    return open(filename, *args, **kwargs)
E   FileNotFoundError: [Errno 2] No such file or directory: '/usr/ports/science/py-pymatgen/work-py311/stage/usr/local/lib/python3.11/site-packages/../tests/files/io/qchem/single_job.json'
___________________________________________________________________________ ERROR collecting tests/io/test_ase.py ___________________________________________________________________________
io/test_ase.py:18: in <module>
    STRUCTURE = Structure.from_file(f"{VASP_IN_DIR}/POSCAR")
../../stage/usr/local/lib/python3.11/site-packages/pymatgen/core/structure.py:3175: in from_file
    with zopen(filename, mode="rt", errors="replace") as file:
/usr/local/lib/python3.11/site-packages/monty/io.py:50: in zopen
    return open(filename, *args, **kwargs)
E   FileNotFoundError: [Errno 2] No such file or directory: '/usr/ports/science/py-pymatgen/work-py311/stage/usr/local/lib/python3.11/site-packages/../tests/files/io/vasp/inputs/POSCAR'
________________________________________________________________________ ERROR collecting tests/io/test_optimade.py _________________________________________________________________________
io/test_optimade.py:9: in <module>
    STRUCTURE = Structure.from_file(f"{VASP_IN_DIR}/POSCAR")
../../stage/usr/local/lib/python3.11/site-packages/pymatgen/core/structure.py:3175: in from_file
    with zopen(filename, mode="rt", errors="replace") as file:
/usr/local/lib/python3.11/site-packages/monty/io.py:50: in zopen
    return open(filename, *args, **kwargs)
E   FileNotFoundError: [Errno 2] No such file or directory: '/usr/ports/science/py-pymatgen/work-py311/stage/usr/local/lib/python3.11/site-packages/../tests/files/io/vasp/inputs/POSCAR'
___________________________________________________________________________ ERROR collecting tests/io/test_res.py ___________________________________________________________________________
io/test_res.py:15: in <module>
    @pytest.mark.parametrize("provider", [AirssProvider.from_file(res_coc, "strict")])
../../stage/usr/local/lib/python3.11/site-packages/pymatgen/io/res.py:433: in from_file
    return cls(ResParser._parse_file(filename), parse_rems)
../../stage/usr/local/lib/python3.11/site-packages/pymatgen/io/res.py:252: in _parse_file
    with zopen(filename, mode="r") as file:
/usr/local/lib/python3.11/site-packages/monty/io.py:50: in zopen
    return open(filename, *args, **kwargs)
E   FileNotFoundError: [Errno 2] No such file or directory: '/usr/ports/science/py-pymatgen/work-py311/stage/usr/local/lib/python3.11/site-packages/../tests/files/io/res/coc-115925-9326-14.res'
__________________________________________________________ ERROR collecting tests/transformations/test_advanced_transformations.py __________________________________________________________
transformations/test_advanced_transformations.py:646: in <module>
    class TestSQSTransformationIcet(PymatgenTest):
transformations/test_advanced_transformations.py:647: in TestSQSTransformationIcet
    stored_run: dict = loadfn(f"{TEST_FILES_DIR}/transformations/icet-sqs-fcc-Mg_75-Al_25-scaling_8.json.gz")
/usr/local/lib/python3.11/site-packages/monty/serialization.py:70: in loadfn
    with zopen(fn, "rt") as fp:
/usr/local/lib/python3.11/site-packages/monty/io.py:47: in zopen
    return gzip.open(filename, *args, **kwargs)
/usr/local/lib/python3.11/gzip.py:58: in open
    binary_file = GzipFile(filename, gz_mode, compresslevel)
/usr/local/lib/python3.11/gzip.py:174: in __init__
    fileobj = self.myfileobj = builtins.open(filename, mode or 'rb')
E   FileNotFoundError: [Errno 2] No such file or directory: '/usr/ports/science/py-pymatgen/work-py311/stage/usr/local/lib/python3.11/site-packages/../tests/files/transformations/icet-sqs-fcc-Mg_75-Al_25-scaling_8.json.gz'
________________________________________________________________________ ERROR collecting tests/vis/test_plotters.py ________________________________________________________________________
vis/test_plotters.py:14: in <module>
    with open(f"{TEST_FILES_DIR}/analysis/spectrum_test/LiCoO2_k_xanes.json") as file:
E   FileNotFoundError: [Errno 2] No such file or directory: '/usr/ports/science/py-pymatgen/work-py311/stage/usr/local/lib/python3.11/site-packages/../tests/files/analysis/spectrum_test/LiCoO2_k_xanes.json'
===================================================================================== warnings summary ======================================================================================
../../../../../../local/lib/python3.11/site-packages/plotly/express/imshow_utils.py:24
  /usr/local/lib/python3.11/site-packages/plotly/express/imshow_utils.py:24: DeprecationWarning: `np.bool8` is a deprecated alias for `np.bool_`.  (Deprecated NumPy 1.24)
    np.bool8: (False, True),

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================== short test summary info ==================================================================================
SKIPPED [1] analysis/test_functional_groups.py:16: could not import 'openbabel': No module named 'openbabel'
SKIPPED [1] electronic_structure/test_boltztrap2.py:27: No boltztrap2
SKIPPED [1] ext/test_matproj.py:44: MP API is down
SKIPPED [1] io/test_babel.py:17: could not import 'openbabel.pybel': No module named 'openbabel'
SKIPPED [1] io/test_openff.py:25: could not import 'openff.toolkit': No module named 'openff'
SKIPPED [1] io/test_packmol.py:23: packmol executable not present
SKIPPED [1] io/test_shengbte.py:9: could not import 'f90nml': No module named 'f90nml'
SKIPPED [1] io/test_zeopp.py:20: zeo not installed
SKIPPED [1] performance/test_import_time.py:32: ref time only comparable in CI runner
SKIPPED [1] symmetry/test_kpath_hin.py:11: seekpath not installed
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 10 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================================================== 10 skipped, 1 warning, 10 errors in 19.15s =========================================================================

Expected Behavior

n/a

Minimal example

No response

Relevant files to reproduce this bug

No response

@yurivict yurivict added the bug label Nov 14, 2024
@yurivict yurivict changed the title 10 tests error out because they fail to find some tests 10 tests error out because they fail to find some files Nov 14, 2024
@DanielYang59
Copy link
Contributor

DanielYang59 commented Nov 15, 2024

Hi @yurivict thanks for asking.

Looks like you installed pymatgen in non-editable mode, pymatgen doesn't include test files as package data, so you have to get the test files (usually by cloning the repo), and use one of the two ways to make test files available:

  • Install pymatgen in editable mode from cloned repo, i.e. python -m pip install -e /path/to/cloned_pymatgen_repo
  • Use the environment variable PMG_TEST_FILES_DIR to point to test files if you don't want to install in editable mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants