aiidalab / aiidalab-widgets-base

Reusable widgets for AiiDAlab applications
MIT License
7 stars 17 forks source link

Test every single widget for the 2.0 release #438

Closed danielhollas closed 1 year ago

danielhollas commented 1 year ago

I think this has not been done, as exemplified in #433.

Before this, we should align ourselves about the breaking changes, discussed in #426

ToDo:

yakutovicha commented 1 year ago

I will work on that as hard as I can. Hopefully, by the next meeting, every widget will have a smoke test.

danielhollas commented 1 year ago

Thanks @yakutovicha! My original idea was to test the widgets manually to verify that they work, but of course if you add tests at the same time that would be awesome!

yakutovicha commented 1 year ago

I will start by adding coverage reports. We will see then how bad we are.

unkcpz commented 1 year ago

Thanks for a great job by @yakutovicha, we can close this one, correct? It means we only have one open issue about whether keep backward compatibility for widgets listed in https://github.com/aiidalab/aiidalab-widgets-base/issues/426. Can we release a beta version so I can update QeApp for the demo?

yakutovicha commented 1 year ago

Thanks for a great job by @yakutovicha, we can close this one, correct? It means we only have one open issue about whether keep backward compatibility for widgets listed in #426.

Not quite yet. There are still 4 modules to be tested.

Can we release a beta version so I can update QeApp for the demo?

This we can always do. I will release a new beta version now.

[UPDATE]

v2.0.0b3 is released.

unkcpz commented 1 year ago

One test for structure module failed locally: "FAILED tests/test_structures.py::test_smiles_widget - AttributeError: 'SmilesWidget' object has no attribute 'smiles'", @yakutovicha

yakutovicha commented 1 year ago

One test for structure module failed locally: "FAILED tests/test_structures.py::test_smiles_widget - AttributeError: 'SmilesWidget' object has no attribute 'smiles'", @yakutovicha

I am confused. Where and when did it happen? I did a couple of merges to the master branch and things worked fine.

unkcpz commented 1 year ago

I test it locally in a brand new aiidalab container.

unkcpz commented 1 year ago

I see, I don't have rdkit installed, and it run in to code below:

class SmilesWidget(ipw.VBox):
    """Convert SMILES into 3D structure."""

    structure = tl.Instance(ase.Atoms, allow_none=True)

    SPINNER = """<i class="fa fa-spinner fa-pulse" style="color:red;" ></i>"""

    def __init__(self, title=""):
        self.title = title

        try:
            from openbabel import openbabel  # noqa: F401
            from openbabel import pybel  # noqa: F401
        except ImportError:
            self.disable_openbabel = True

        try:  # noqa: TC101
            from rdkit import Chem  # noqa: F401
            from rdkit.Chem import AllChem  # noqa: F401
        except ImportError:
            super().__init__(
                [
                    ipw.HTML(
                        "The SmilesWidget requires the rdkit library, "
                        "but the library was not found."
                    )
                ]
            )
            return

        self.smiles = ipw.Text(placeholder="C=C")

But I am curious why the test pass in github action .. :thinking:

yakutovicha commented 1 year ago

But I am curious why the test pass in github action .. 🤔

There is a smiles option that installs those: https://github.com/aiidalab/aiidalab-widgets-base/blob/3b7aff7eed76bd51d7232836cce470c8c6256df3/setup.cfg#L61-L63

We enable it for the tests.

unkcpz commented 1 year ago

I see, then it is all fine. Thanks!