Compact _compare_wyckoffs
#739
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tests | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - '*' # all branches | |
| jobs: | |
| test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ ubuntu-latest, macos-14 ] # Windows in theory possible, but needs circumventing ``vise`` issues | |
| python-version: [ '3.11', '3.14' ] # lowest and highest supported Python versions; 3.10 should still be possible, but latest ``pymatgen`` (2026) only supports 3.11-3.14 | |
| # if durations files present, pytest-split will use them to intelligently distribute tests | |
| split: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] | |
| env: | |
| MPLBACKEND: Agg # non-interactive backend for matplotlib | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| # TODO: temporary until doped v4 released: | |
| pip install --no-deps git+https://github.com/SMTG-Bham/ShakeNBreak@develop | |
| pip install -e .[tests] | |
| - name: Test | |
| shell: bash | |
| run: | # update durations file with ``export DOPED_SKIP_HEAVY_TESTS=False; pytest -vv -m "not mpl_image_compare" tests --store-durations --durations-path tests/.pytest_split_durations_non_plotting`` | |
| pytest -vv -m "not mpl_image_compare" \ | |
| --splits 10 --group ${{ matrix.split }} \ | |
| --durations-path tests/.pytest_split_durations_non_plotting \ | |
| --splitting-algorithm least_duration tests # use this algo to avoid zero-splits | |
| - name: Plotting Tests | |
| shell: bash | |
| if: always() # run even if non-plotting tests fail | |
| id: plotting_tests # Add an ID to this step for reference | |
| env: | |
| MPLBACKEND: Agg # non-interactive backend for matplotlib | |
| run: | # update durations file with ``export DOPED_SKIP_HEAVY_TESTS=False; pytest -vv -m "mpl_image_compare" tests --store-durations --durations-path tests/.pytest_split_durations_plotting`` | |
| pytest -vv --mpl -m "mpl_image_compare" \ | |
| --splits 10 --group ${{ matrix.split }} \ | |
| --durations-path tests/.pytest_split_durations_plotting \ | |
| --splitting-algorithm least_duration tests # use this algo to avoid zero-splits | |
| - name: Generate GH Actions test plots | |
| shell: bash | |
| if: failure() && steps.plotting_tests.outcome == 'failure' # Run only if plotting tests fail | |
| env: | |
| MPLBACKEND: Agg # non-interactive backend for matplotlib | |
| run: | # Generate the test plots in case there were any failures: | |
| pytest -vv --mpl-generate-path=tests/remote_baseline -m "mpl_image_compare" \ | |
| --splits 10 --group ${{ matrix.split }} \ | |
| --durations-path tests/.pytest_split_durations_plotting \ | |
| --splitting-algorithm least_duration tests # use this algo to avoid zero-splits | |
| # Upload test plots | |
| - name: Archive test plots | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: doped_GH_test_plots_${{ matrix.os }}_${{ matrix.split }} | |
| path: tests/remote_baseline |