materialsproject / crystaltoolkit

Crystal Toolkit is a framework for building web apps for materials science and is currently powering the new Materials Project website.
https://docs.crystaltoolkit.org
Other
135 stars 57 forks source link

Bug fixes and testing #386

Closed jmmshn closed 1 month ago

jmmshn commented 1 month ago

Minor fixes

  1. Scene._repr_mimebundle_ calls self.as_dict. Since Scene is not MSONable this breaks the code.

  2. Allow display_color to be set on a subset of atoms. If the display_color is set only on a subset of atoms, pymatgen will set the rest to None, in those cases we should still use the defaults.

  3. Display MSONables. There were a couple of typo bugs in the Jupyter code for MSONables.

  1. Moved app testing imports into test functions.

Local installations can run into weird issues since we are supporting so many different codes. Namely installing IFermi on Mac is sometimes problematic due to FFTW package. Moving the imports inside the test allows you to avoid these imports easily using pytest -k

  1. Moved unused tests into the root/tests directory and updated them to work with the current code.

  2. Added test for the interaction between the patched MSONable objects and Ipython

mkhorton commented 1 month ago

Thanks for patch, I believe you still have write access so please merge when ready!

jmmshn commented 1 month ago

Thanks, @mkhorton, will merge once I figure out the tests. It's been a while since I looked at this code and some things have changed quite a bit.

It looks like my test failures are related to the dash_duo setup which I'm pretty unfamiliar with. @janosh can you direct me where how to fix this?

=========================== short test summary info ============================
FAILED crystal_toolkit/apps/examples/tests/test_bandstructure.py::test_bs - AssertionError: Unexpected browser logs=None
assert None == []
FAILED crystal_toolkit/apps/examples/tests/test_basic.py::test_hello_scientist - AssertionError: Unexpected browser logs=None
assert None == []
FAILED crystal_toolkit/apps/examples/tests/test_basic.py::test_hello_structure - AssertionError: Unexpected browser logs=None
assert None == []
FAILED crystal_toolkit/apps/examples/tests/test_basic.py::test_hello_structure_interactive - AssertionError: Unexpected browser logs=None
assert None == []
FAILED crystal_toolkit/apps/examples/tests/test_diffraction.py::test_diffraction - AssertionError: Unexpected browser logs=None
assert None == []
FAILED crystal_toolkit/apps/examples/tests/test_fermi_surface.py::test_diffraction - AssertionError: Unexpected browser logs=None
assert None == []
FAILED crystal_toolkit/apps/examples/tests/test_structure.py::test_structure - AssertionError: Unexpected browser logs=None
assert None == []
============================== 7 failed in 40.18s ==============================
Error: Process completed with exit code 1.
jmmshn commented 1 month ago

nvm it's just due to some drift in behavior of dash things I guess. This brings up another question: do we need to lock down versions of dependencies for testing?