Skip to content

Commit

Permalink
raise PendingDeprecationWarning
Browse files Browse the repository at this point in the history
  • Loading branch information
robinzyb committed Oct 30, 2023
1 parent 3ee373d commit 5028af6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions dpdata/plugins/cp2k.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
@Format.register("cp2k/aimd_output")
class CP2KAIMDOutputFormat(Format):
def from_labeled_system(self, file_name, restart=False, **kwargs):
xyz_file = sorted(glob.glob(f"{file_name}/*pos*.xyz"))[0]
log_file = sorted(glob.glob(f"{file_name}/*.log"))[0]
try:
xyz_file = sorted(glob.glob(f"{file_name}/*pos*.xyz"))[0]
log_file = sorted(glob.glob(f"{file_name}/*.log"))[0]
return tuple(Cp2kSystems(log_file, xyz_file, restart))
except (StopIteration, RuntimeError):
except (StopIteration, RuntimeError) as e:

Check warning on line 24 in dpdata/plugins/cp2k.py

View check run for this annotation

Codecov / codecov/patch

dpdata/plugins/cp2k.py#L24

Added line #L24 was not covered by tests
# StopIteration is raised when pattern match is failed
print(string_warning)
raise PendingDeprecationWarning(string_warning) from e

Check warning on line 26 in dpdata/plugins/cp2k.py

View check run for this annotation

Codecov / codecov/patch

dpdata/plugins/cp2k.py#L26

Added line #L26 was not covered by tests


@Format.register("cp2k/output")
Expand All @@ -47,5 +47,5 @@ def from_labeled_system(self, file_name, restart=False, **kwargs):
# TODO: in the future, we should add exact error type here
# TODO: when pattern match is failed
# TODO: For now just use RuntimeError as a placeholder.
except RuntimeError:
print(string_warning)
except RuntimeError as e:
raise PendingDeprecationWarning(string_warning) from e

Check warning on line 51 in dpdata/plugins/cp2k.py

View check run for this annotation

Codecov / codecov/patch

dpdata/plugins/cp2k.py#L50-L51

Added lines #L50 - L51 were not covered by tests

0 comments on commit 5028af6

Please sign in to comment.