Skip to content

Commit

Permalink
test: skip test of electronic_configuration_embedding if mendeleev is…
Browse files Browse the repository at this point in the history
… not installed (#3755)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Chores**
- Updated the pre-commit hooks to a newer version for improved
performance and bug fixes.
  
- **Tests**
- Enhanced test reliability by skipping certain tests if the required
`mendeleev` module is not available.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Han Wang <wang_han@iapcm.ac.cn>
  • Loading branch information
wanghan-iapcm and Han Wang authored May 7, 2024
1 parent dda6bcc commit df345ec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ repos:
exclude: ^source/3rdparty
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.4.2
rev: v0.4.3
hooks:
- id: ruff
args: ["--fix"]
Expand Down
8 changes: 8 additions & 0 deletions source/tests/common/test_econf_embd.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@
make_econf_embedding,
)

try:
import mendeleev # noqa: F401

has_mendeleev = True
except ImportError:
has_mendeleev = False


@unittest.skipIf(not has_mendeleev, "does not have mendeleev installed, skip the UTs.")
class TestEConfEmbd(unittest.TestCase):
def test_fe(self):
res = make_econf_embedding(["Fe"], flatten=False)["Fe"]
Expand Down

0 comments on commit df345ec

Please sign in to comment.