Closed tfrederiksen closed 1 year ago
Could you try the procedure outlined here https://zerothi.github.io/sisl/installation.html#testing-your-installation
It should definitely be linked in contributing, I will do that. (keep this open so I remember).
Sorry, I am AFK at the moment.
Great, it works! Now I get:
$ SISL_FILES_TESTS=$(pwd)/sisl-files/tests pytest-3 --pyargs sisl.io.siesta.tests.test_out
. ...... [100%]
====== 6 passed, 1 warning in 1.35s =======
However, most other siesta tests are failing! For instance
$ SISL_FILES_TESTS=$(pwd)/sisl-files/tests pytest-3 --pyargs sisl.io.siesta.tests.test_bands
=================== test session starts ===================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /home/username
plugins: flake8-1.0.6, pylint-0.18.0
collected 3 items
. FFF [100%]
======================== FAILURES =========================
_________________________ test_fe _________________________
sisl_files = <function sisl_files.<locals>._path at 0x7f3f42638c10>
def test_fe(sisl_files):
si = sisl.get_sile(sisl_files(_dir, 'fe.bands'))
> labels, k, eig = si.read_data()
../../.local/lib/python3.10/site-packages/sisl/io/siesta/tests/test_bands.py:17:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../.local/lib/python3.10/site-packages/sisl/io/sile.py:544: in pre_open
return func(self, *args, **kwargs)
../../.local/lib/python3.10/site-packages/sisl/io/siesta/bands.py:42: in read_data
Ef = self.read_fermi_level()
../../.local/lib/python3.10/site-packages/sisl/io/sile.py:533: in pre_open
return func(self, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <sisl.io.siesta.bandsSileSiesta object at 0x7f3ef6b70970>
@sile_fh_open(True)
def read_fermi_level(self):
""" Returns the Fermi level in the bands file """
# Luckily the data is in eV
> return float(self.readline())
E ValueError: could not convert string to float: 'version https://git-lfs.github.com/spec/v1\n'
../../.local/lib/python3.10/site-packages/sisl/io/siesta/bands.py:24: ValueError
_________________ test_fe_ArgumentParser __________________
sisl_files = <function sisl_files.<locals>._path at 0x7f3f42638c10>
sisl_tmp = <sisl.conftest.sisl_tmp.<locals>.FileFactory object at 0x7f3ef68a3070>
def test_fe_ArgumentParser(sisl_files, sisl_tmp):
pytest.importorskip("matplotlib", reason="matplotlib not available")
png = sisl_tmp('fe.bands.png', _dir)
si = sisl.get_sile(sisl_files(_dir, 'fe.bands'))
> p, ns = si.ArgumentParser()
../../.local/lib/python3.10/site-packages/sisl/io/siesta/tests/test_bands.py:27:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../.local/lib/python3.10/site-packages/sisl/utils/cmd.py:201: in new_func
return func(self, parser, *args, **kwargs)
../../.local/lib/python3.10/site-packages/sisl/io/siesta/bands.py:123: in ArgumentParser
_bands= self.read_data(),
../../.local/lib/python3.10/site-packages/sisl/io/sile.py:544: in pre_open
return func(self, *args, **kwargs)
../../.local/lib/python3.10/site-packages/sisl/io/siesta/bands.py:42: in read_data
Ef = self.read_fermi_level()
../../.local/lib/python3.10/site-packages/sisl/io/sile.py:533: in pre_open
return func(self, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <sisl.io.siesta.bandsSileSiesta object at 0x7f3ef68a2b30>
@sile_fh_open(True)
def read_fermi_level(self):
""" Returns the Fermi level in the bands file """
# Luckily the data is in eV
> return float(self.readline())
E ValueError: could not convert string to float: 'version https://git-lfs.github.com/spec/v1\n'
../../.local/lib/python3.10/site-packages/sisl/io/siesta/bands.py:24: ValueError
_____________________ test_fe_xarray ______________________
sisl_files = <function sisl_files.<locals>._path at 0x7f3f42638c10>
sisl_tmp = <sisl.conftest.sisl_tmp.<locals>.FileFactory object at 0x7f3ef6b71c00>
def test_fe_xarray(sisl_files, sisl_tmp):
pytest.importorskip("xarray", reason="xarray not available")
si = sisl.get_sile(sisl_files(_dir, 'fe.bands'))
> bands = si.read_data(as_dataarray=True)
../../.local/lib/python3.10/site-packages/sisl/io/siesta/tests/test_bands.py:37:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../.local/lib/python3.10/site-packages/sisl/io/sile.py:544: in pre_open
return func(self, *args, **kwargs)
../../.local/lib/python3.10/site-packages/sisl/io/siesta/bands.py:42: in read_data
Ef = self.read_fermi_level()
../../.local/lib/python3.10/site-packages/sisl/io/sile.py:533: in pre_open
return func(self, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <sisl.io.siesta.bandsSileSiesta object at 0x7f3ef6b71cf0>
@sile_fh_open(True)
def read_fermi_level(self):
""" Returns the Fermi level in the bands file """
# Luckily the data is in eV
> return float(self.readline())
E ValueError: could not convert string to float: 'version https://git-lfs.github.com/spec/v1\n'
../../.local/lib/python3.10/site-packages/sisl/io/siesta/bands.py:24: ValueError
==================== warnings summary =====================
../../../../usr/lib/python3/dist-packages/blosc/toplevel.py:12
/usr/lib/python3/dist-packages/blosc/toplevel.py:12: DeprecationWarning: The distutils package
is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for
potential alternatives from distutils.version import LooseVersion
-- Docs: https://docs.pytest.org/en/stable/warnings.html
================= short test summary info =================
FAILED ::test_fe - ValueError: could not convert string ...
FAILED ::test_fe_ArgumentParser - ValueError: could not ...
FAILED ::test_fe_xarray - ValueError: could not convert ...
============== 3 failed, 1 warning in 1.41s ===============
I'll have a look at it when I get back, you can just concentrate on the orca ;)
I looks like the test directory hasn't been fetched, or that you run the pytest command in the sisl
code directory, generally you should run it in another directory than your sisl
top level.
I suspect that this is related to git-lfs
and tools on my machine. For instance, I realize now that the content of the local sisl-files/tests/sisl/io/siesta/fe.bands
(involved in the first failure above) does not contain the actual data, only a hash.
Yes, that indicates you haven't installed git-lfs
Thanks, I fixed it this way:
git-lfs
sisl-files
git clone git@github.com:tfrederiksen/sisl-files.git
(now it correctly fetches the large, actual data files)SISL_FILES_TESTS=$(pwd)/sisl-files/tests pytest-3 --pyargs sisl.io.siesta
most tests now pass:
======================= test session starts ========================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /home/username
plugins: flake8-1.0.6, pylint-0.18.0
collected 134 items
tests/test_bands.py ... [ 2%] tests/test_basis.py ..... [ 5%] tests/test_dm.py .....x [ 10%] tests/test_eig.py ..... [ 14%] tests/test_fa.py .. [ 15%] tests/test_fc.py .. [ 17%] tests/test_fdf.py ...................x [ 32%] tests/test_gf.py ..... [ 35%] tests/test_grid.py .... [ 38%] tests/test_hsx.py ........... [ 47%] tests/test_kp.py .. [ 48%] tests/test_orb_indx.py . [ 49%] tests/test_out.py ...... [ 53%] tests/test_out_charges.py .................. [ 67%] tests/test_pdos.py .... [ 70%] tests/test_siesta.py ................ [ 82%] tests/test_struct.py .... [ 85%] tests/test_tsde.py ... [ 87%] tests/test_tshs.py ............ [ 96%] tests/test_wfsx.py . [ 97%] tests/test_xv.py .... [100%]
========================= warnings summary ========================= ../../../../usr/lib/python3/dist-packages/blosc/toplevel.py:12 /usr/lib/python3/dist-packages/blosc/toplevel.py:12: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives from distutils.version import LooseVersion
tests/test_out_charges.py::test_vh_md_scf[voronoi-md_scf] tests/test_out_charges.py::test_vh_md_scf[voronoi-nc_md_scf] tests/test_out_charges.py::test_vh_md_scf[voronoi-pol_md_scf] tests/test_out_charges.py::test_vh_md_scf[voronoi-soc_md_scf] tests/test_out_charges.py::test_vh_md_scf[Hirshfeld-md_scf] tests/test_out_charges.py::test_vh_md_scf[Hirshfeld-nc_md_scf] tests/test_out_charges.py::test_vh_md_scf[Hirshfeld-pol_md_scf] tests/test_out_charges.py::test_vh_md_scf[Hirshfeld-soc_md_scf] /usr/lib/python3/dist-packages/pluggy/callers.py:187: FutureWarning: arrays to stack must be passed as a "sequence" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future. res = hook_impl.function(*args)
-- Docs: https://docs.pytest.org/en/stable/warnings.html ============ 132 passed, 2 xfailed, 9 warnings in 7.82s ============
I think the FutureWarning
is raised without checking the argument type. At least I also get it and checked that the type is a list
, so I think we can safely ignore this. Otherwise the testing should fail since we test against newer numpy versions.
I have fixed the documentation, thanks!
I looked around but couldn't figure this out: How do I run
pytest
for the sisl tests involvingsisl-files
?For instance, all tests are simply skipped if I do: