Information on how to run the tests
srmnitc opened this issue ยท 6 comments
Is your feature request related to a problem? Please describe.
This is part of the review over at openjournals/joss-reviews#6286. The project seems to have automated tests, but I could not find instructions on how a user can run the tests. This would allow me to check off the 'Automated Tests' in the review.
Describe the solution you'd like
Add a documentation on how to run tests in both README and documentation page
Describe alternatives you've considered
None
Additional context
None
Thank you, @srmnitc . Could you check if this description works: https://jageo.github.io/LobsterPy/dev/dev_installation.html ?
If not, please let us know and we are happy to help.
Meanwhile, @naik-aakash and I will be thinking about how to make this documentation part more discoverable.
Perfect @JaGeo! That works, I was able to run the tests. Once again, a link to the dev docs would be nice, but everything works very well. Feel free to close the issue.
One of my tests failed, could you please tell me if I should do anything more?
============================================================================================== FAILURES ===============================================================================================
_______________________________________________________________________________ TestCLI.test_calc_quality_summary_nacl ________________________________________________________________________________
self = <tests.cli.test_cli.TestCLI object at 0x7f009bdecf90>, tmp_path = PosixPath('/tmp/pytest-of-menon/pytest-59/test_calc_quality_summary_nacl0')
def test_calc_quality_summary_nacl(self, tmp_path):
os.chdir(TestDir / "test_data/NaCl_comp_range")
calc_quality_json_path = tmp_path / "calc_quality_json.json"
args = [
"description-quality",
"--potcar-symbols",
"Na_pv Cl",
"--bvacomp",
"--doscomp",
"--erange",
"-20",
"0",
"--file-calc-quality-json",
str(calc_quality_json_path),
]
captured_output = io.StringIO()
sys.stdout = captured_output
test = get_parser().parse_args(args)
> run(test)
/mnt/c/Users/menon/Documents/winrepos/projects-joss/LobsterPy/tests/cli/test_cli.py:376:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/mnt/c/Users/menon/Documents/winrepos/projects-joss/LobsterPy/lobsterpy/cli.py:1166: in run
quality_dict = Analysis.get_lobster_calc_quality_summary(
/mnt/c/Users/menon/Documents/winrepos/projects-joss/LobsterPy/lobsterpy/cohp/analyze.py:1608: in get_lobster_calc_quality_summary
vasprun = Vasprun(path_to_vasprun)
/home/menon/miniconda3/envs/lobsterpy3/lib/python3.11/site-packages/pymatgen/io/vasp/outputs.py:296: in __init__
self.update_potcar_spec(parse_potcar_file)
/home/menon/miniconda3/envs/lobsterpy3/lib/python3.11/site-packages/pymatgen/io/vasp/outputs.py:1054: in update_potcar_spec
if potcar := self.get_potcars(path):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pymatgen.io.vasp.outputs.Vasprun object at 0x7f00960593d0>, path = True
def get_potcars(self, path: str | Path) -> Potcar | None:
"""
Returns the POTCAR from the specified path.
Args:
path (str | Path): The path to search for POTCARs.
Returns:
Potcar | None: The POTCAR from the specified path or None if not found/no path specified.
"""
if not path:
return None
if isinstance(path, (str, Path)) and "POTCAR" in str(path):
potcar_paths = [str(path)]
else:
search_path = os.path.split(self.filename)[0] if path is True else str(path)
potcar_paths = [
> f"{search_path}/{fn}" for fn in os.listdir(search_path) if fn.startswith("POTCAR") and ".spec" not in fn
]
E FileNotFoundError: [Errno 2] No such file or directory: ''
/home/menon/miniconda3/envs/lobsterpy3/lib/python3.11/site-packages/pymatgen/io/vasp/outputs.py:1010: FileNotFoundError
======================================================================================== slowest 30 durations =========================================================================================
16.99s call tests/cli/test_cli.py::TestCLI::test_cli_interactive_plotter_coops
4.83s call tests/cli/test_cli.py::TestCLI::test_cli_interactive_plotter_cobi
3.64s call tests/cli/test_cli.py::TestCLI::test_calc_quality_summary_nacl
1.26s call tests/cli/test_cli.py::TestCLI::test_cli_results[args0]
1.24s call tests/cli/test_cli.py::TestCLI::test_hideplot_cli
1.14s call tests/cli/test_cli.py::TestCLI::test_cli_interactive_plotter
0.57s call tests/cli/test_cli.py::TestCLI::test_icoxxlist_plots
0.48s call tests/cli/test_cli.py::TestCLI::test_iaplot_saved
0.47s call tests/cli/test_cli.py::TestCLI::test_cli_results[args2]
0.47s call tests/cli/test_cli.py::TestCLI::test_json_saved
0.38s call tests/cli/test_cli.py::TestCLI::test_cli_results[args1]
0.34s call tests/cli/test_cli.py::TestCLI::test_plot_saved
0.32s call tests/cli/test_cli.py::TestCLI::test_cli_results[args3]
0.31s call tests/cli/test_cli.py::TestCLI::test_cli_results[args5]
0.30s call tests/cli/test_cli.py::TestCLI::test_cli_results[args4]
0.22s call tests/cli/test_cli.py::TestCLI::test_cli_results[args8]
0.21s call tests/cli/test_cli.py::TestCLI::test_cli_results[args7]
0.21s call tests/cli/test_cli.py::TestCLI::test_cli_results[args15]
0.20s call tests/cli/test_cli.py::TestCLI::test_cli_results[args11]
0.19s call tests/cli/test_cli.py::TestCLI::test_cli_results[args13]
0.18s call tests/cli/test_cli.py::TestCLI::test_cli_results[args14]
0.18s call tests/cli/test_cli.py::TestCLI::test_lobsterin_generation
0.17s call tests/cli/test_cli.py::TestCLI::test_cli_results[args16]
0.17s call tests/cli/test_cli.py::TestCLI::test_cli_results[args10]
0.17s call tests/cli/test_cli.py::TestCLI::test_cli_results[args17]
0.16s call tests/cli/test_cli.py::TestCLI::test_cli_results[args6]
0.16s call tests/cli/test_cli.py::TestCLI::test_cli_results[args18]
0.16s call tests/cli/test_cli.py::TestCLI::test_cli_results[args12]
0.15s call tests/cli/test_cli.py::TestCLI::test_cli_results[args9]
0.15s call tests/cli/test_cli.py::TestCLI::test_lobsterin_generation_error
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 34 passed in 40.02s
Could you please download the latest main branch, upgrade the pymatgen version (pip install --upgrade pymatgen
) and check if the error persists? I assume it is a related to a very recent upgrade in pymatgen. @naik-aakash fixed that error yesterday here on the main branch.
Could you please download the latest main branch, upgrade the pymatgen version (
pip install --upgrade pymatgen
) and check if the error persists? I assume it is a related to a very recent upgrade in pymatgen. @naik-aakash fixed that error yesterday here on the main branch.
This solution worked, thanks.