Skip to content

Commit

Permalink
fix: unmark eval_pd as abstractmethod (deepmodeling#4438)
Browse files Browse the repository at this point in the history
Many classes don't have this method and become abstract classes. It
looks to me like these tests are skipped silently and don't throw
errors.

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

## Summary by CodeRabbit

- **Bug Fixes**
- Updated the `eval_pd` method to provide a clearer indication of its
implementation status by raising a `NotImplementedError`.
- Changed the `skip_pd` class variable to always skip Paddle-related
tests.

- **Tests**
- Adjusted the `skip_pd` property in the `TestSeA` and `TestEner`
classes to directly reflect the installation status of Paddle.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz authored Nov 28, 2024
1 parent f7e4cdf commit a852aa9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions source/tests/consistent/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class CommonTest(ABC):
# we may usually skip jax before jax is fully supported
skip_jax: ClassVar[bool] = True
"""Whether to skip the JAX model."""
skip_pd: ClassVar[bool] = not INSTALLED_PD
skip_pd: ClassVar[bool] = True
"""Whether to skip the Paddle model."""
skip_array_api_strict: ClassVar[bool] = True
"""Whether to skip the array_api_strict model."""
Expand Down Expand Up @@ -185,7 +185,6 @@ def eval_jax(self, jax_obj: Any) -> Any:
"""
raise NotImplementedError("Not implemented")

@abstractmethod
def eval_pd(self, pd_obj: Any) -> Any:
"""Evaluate the return value of PD.
Expand All @@ -194,6 +193,7 @@ def eval_pd(self, pd_obj: Any) -> Any:
pd_obj : Any
The object of PD
"""
raise NotImplementedError("Not implemented")

def eval_array_api_strict(self, array_api_strict_obj: Any) -> Any:
"""Evaluate the return value of array_api_strict.
Expand Down
2 changes: 1 addition & 1 deletion source/tests/consistent/descriptor/test_se_e2_a.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def skip_pd(self) -> bool:
precision,
env_protection,
) = self.param
return CommonTest.skip_pd
return not INSTALLED_PD

@property
def skip_array_api_strict(self) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion source/tests/consistent/fitting/test_ener.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def skip_pd(self) -> bool:
) = self.param
# Paddle do not support "bfloat16" in some kernels,
# so skip this in CI test
return CommonTest.skip_pd or precision == "bfloat16"
return not INSTALLED_PD or precision == "bfloat16"

tf_class = EnerFittingTF
dp_class = EnerFittingDP
Expand Down

0 comments on commit a852aa9

Please sign in to comment.