Skip to content

Commit

Permalink
Support recent versions of pymatgen (#39)
Browse files Browse the repository at this point in the history
* added try except to_string VS to_str

* fix tests

* update flake8

* CI: separate coveralls upload to its own step

* use coveralls parallel version

* CI: add comment about coveralls

---------

Co-authored-by: Kristjan Eimre <[email protected]>
  • Loading branch information
cpignedoli and eimrek authored Jul 26, 2024
1 parent 663a557 commit 272d8cb
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 7 deletions.
21 changes: 18 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,23 @@ jobs:
env:
# show timings of tests
PYTEST_ADDOPTS: --durations=0
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
py.test --cov aiida_gaussian --cov-append .
coveralls --service=github
# note that for a matrix test that will send multiple reports to coveralls,
# the parallel version should be used to avoid errors.
- name: Send coverage to Coveralls (parallel)
uses: coverallsapp/github-action@v2
with:
parallel: true
flag-name: run ${{ join(matrix.*, ' - ') }}

coveralls-finish:
needs: tests
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ repos:
- id: black
language_version: python3
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 7.1.0
hooks:
- id: flake8
args: [--count, --show-source, --statistics]
Expand Down
5 changes: 4 additions & 1 deletion aiida_gaussian/calculations/gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,7 @@ def _render_input_string_from_params(cls, parameters, pmg_structure):
parameters.setdefault("spin_multiplicity", parameters.pop("multiplicity", None))
parameters["title"] = "input generated by the aiida-gaussian plugin"
gaussian_input = GaussianInput(pmg_structure, **parameters)
return gaussian_input.to_string(cart_coords=True)
try:
return gaussian_input.to_string(cart_coords=True)
except AttributeError:
return gaussian_input.to_str(cart_coords=True)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ testing = [
"pgtest~=1.3.2",
"wheel~=0.31",
"coverage",
"pytest~=6.1",
"pytest~=7.0",
"pytest-cov",
"pytest-regressions~=2.2",
"coveralls",
Expand Down
10 changes: 9 additions & 1 deletion tests/parsers/test_base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
"""Tests for the :class:`aiida_gaussian.parsers.gaussian.GaussianBaseParser` class."""
"""
Tests for the :class:`aiida_gaussian.parsers.gaussian.GaussianBaseParser` class.
Note on updated parsers (e.g. in Pymatgen) and data_regression:
If newer versions of parsers add extra fields, just update the reference data with
pytest --force-regen
Although this will cause tests to fails with folder versions of the parser, but in
general it should not be a problem.
"""
# pylint: disable=redefined-outer-name


Expand Down
2 changes: 2 additions & 0 deletions tests/parsers/test_base/test_nan_inf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ metadata:
- 1127102.5
functional: M062X
legacy_package_version: 16revisionC.02
memory_available: 300000000000
methods:
- DFT
num_cpu: 44
package: Gaussian
package_version: 2016+C.02
platform: ES64L
Expand Down

0 comments on commit 272d8cb

Please sign in to comment.