diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index acbd63e1..e8467772 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -28,8 +28,8 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - cache: 'pip' - cache-dependency-path: '**/pyproject.toml' + cache: "pip" + cache-dependency-path: "**/pyproject.toml" - name: Install webdriver run: sudo apt-get update && sudo apt-get install chromium-chromedriver - name: Install dependencies @@ -38,10 +38,15 @@ jobs: python${{ matrix.python-version }} -m pip install `grep numpy== requirements/ubuntu-latest_py${{ matrix.python-version }}_extras.txt` python${{ matrix.python-version }} -m pip install -r requirements/ubuntu-latest_py${{ matrix.python-version }}_extras.txt python${{ matrix.python-version }} -m pip install --upgrade pip - python${{ matrix.python-version }} -m pip install --no-deps .[server] + python${{ matrix.python-version }} -m pip install --no-deps .[server,test] - name: Test modules - run: python${{ matrix.python-version }} -m pytest tests + run: python${{ matrix.python-version }} -m pytest --cov=crystal_toolkit --cov-report=xml tests - name: Test example apps env: PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} - run: python${{ matrix.python-version }} -m pytest --color=yes --webdriver Chrome --headless crystal_toolkit/apps/examples/tests/ + run: python${{ matrix.python-version }} -m pytest --cov=crystal_toolkit --cov-report=xml --color=yes --webdriver Chrome --headless crystal_toolkit/apps/examples/tests/ + - uses: codecov/codecov-action@v1 + if: matrix.python-version == 3.10 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.xml diff --git a/crystal_toolkit/apps/tests/test_main.py b/crystal_toolkit/apps/tests/test_main.py index 0447caf6..b2c4b51b 100644 --- a/crystal_toolkit/apps/tests/test_main.py +++ b/crystal_toolkit/apps/tests/test_main.py @@ -20,4 +20,4 @@ def test_main_app_startup(dash_duo: DashDuo): dash_duo.take_snapshot("main_app_startup-layout") logs = dash_duo.get_logs() - assert logs is None, f"Unexpected browser {logs=}" + assert not logs, f"Unexpected browser {logs=}" diff --git a/pyproject.toml b/pyproject.toml index 93f037ba..c58638ee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,7 @@ server = ["dash-extensions", "gunicorn[gevent]", "habanero", "hiphive", "redis"] robocrys = ["robocrys"] temdiff = ["py4DSTEM>=0.13.11"] fermi = ["ifermi", "pyfftw"] +phonon = ["phonopy"] vtk = ["dash-vtk"] localenv = ["dscribe"] figures = ["kaleido"] @@ -135,3 +136,27 @@ no_implicit_optional = false [tool.versioningit.vcs] default-tag = "0.0.1" method = "git" + +[tool.coverage.run] +branch = true +include = ["crystal_toolkit/*"] +omit = ["crystal_toolkit/apps/*",] + +[tool.coverage.paths] +source = ["crystal_toolkit/"] + +[tool.coverage.report] +show_missing = true +skip_covered = true +exclude_also = [ + "def __repr__", + "if self.debug:", + "if settings.DEBUG", + "raise AssertionError", + "raise NotImplementedError", + "if 0:", + "if __name__ == .__main__.:", + "if TYPE_CHECKING:", + "class .*\\bProtocol\\):", + "@(abc\\.)?abstractmethod", + ] diff --git a/requirements/ubuntu-latest_py3.10.txt b/requirements/ubuntu-latest_py3.10.txt index 78846a8a..9a506e81 100644 --- a/requirements/ubuntu-latest_py3.10.txt +++ b/requirements/ubuntu-latest_py3.10.txt @@ -2,7 +2,7 @@ # This file is autogenerated by pip-compile with Python 3.10 # by the following command: # -# pip-compile --output-file=requirements/ubuntu-latest_py3.10.txt pyproject.toml +# pip-compile --output-file=./requirements/ubuntu-latest_py3.10.txt pyproject.toml # aiofiles==22.1.0 # via ypy-websocket diff --git a/requirements/ubuntu-latest_py3.10_extras.txt b/requirements/ubuntu-latest_py3.10_extras.txt index d4ed5b4c..50667739 100644 --- a/requirements/ubuntu-latest_py3.10_extras.txt +++ b/requirements/ubuntu-latest_py3.10_extras.txt @@ -2,7 +2,7 @@ # This file is autogenerated by pip-compile with Python 3.10 # by the following command: # -# pip-compile --all-extras --output-file=requirements/ubuntu-latest_py3.10_extras.txt pyproject.toml +# pip-compile --all-extras --output-file=./requirements/ubuntu-latest_py3.10_extras.txt pyproject.toml # aiofiles==22.1.0 # via ypy-websocket @@ -284,6 +284,7 @@ h5py==3.11.0 # hdf5plugin # hiphive # ncempy + # phonopy # py4dstem habanero==1.2.6 # via crystal_toolkit (pyproject.toml) @@ -448,6 +449,7 @@ matplotlib==3.9.2 # boltztrap2 # ifermi # ncempy + # phonopy # py4dstem # pymatgen # vtk @@ -563,6 +565,7 @@ numpy==1.26.4 # numba # numpy-stl # pandas + # phonopy # py4dstem # pyfftw # pylops @@ -775,6 +778,7 @@ pyyaml==6.0.2 # dask # distributed # jupyter-events + # phonopy # pre-commit # pyaml # pybtex @@ -914,6 +918,7 @@ spglib==2.5.0 # boltztrap2 # hiphive # ifermi + # phonopy # pymatgen # robocrys sphinx==7.4.7 diff --git a/requirements/ubuntu-latest_py3.11.txt b/requirements/ubuntu-latest_py3.11.txt index fb47212b..a88e22bd 100644 --- a/requirements/ubuntu-latest_py3.11.txt +++ b/requirements/ubuntu-latest_py3.11.txt @@ -2,7 +2,7 @@ # This file is autogenerated by pip-compile with Python 3.11 # by the following command: # -# pip-compile --output-file=requirements/ubuntu-latest_py3.11.txt pyproject.toml +# pip-compile --output-file=./requirements/ubuntu-latest_py3.11.txt pyproject.toml # aiofiles==22.1.0 # via ypy-websocket diff --git a/requirements/ubuntu-latest_py3.11_extras.txt b/requirements/ubuntu-latest_py3.11_extras.txt index 3d7aa452..2fc02979 100644 --- a/requirements/ubuntu-latest_py3.11_extras.txt +++ b/requirements/ubuntu-latest_py3.11_extras.txt @@ -273,6 +273,7 @@ h5py==3.11.0 # hdf5plugin # hiphive # ncempy + # phonopy # py4dstem habanero==1.2.6 # via crystal_toolkit (pyproject.toml) @@ -437,6 +438,7 @@ matplotlib==3.9.2 # boltztrap2 # ifermi # ncempy + # phonopy # py4dstem # pymatgen # vtk @@ -552,6 +554,7 @@ numpy==1.26.4 # numba # numpy-stl # pandas + # phonopy # py4dstem # pyfftw # pylops @@ -764,6 +767,7 @@ pyyaml==6.0.2 # dask # distributed # jupyter-events + # phonopy # pre-commit # pyaml # pybtex @@ -903,6 +907,7 @@ spglib==2.5.0 # boltztrap2 # hiphive # ifermi + # phonopy # pymatgen # robocrys sphinx==7.4.7