Skip to content

Commit

Permalink
add exact except for the cp2k plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
robinzyb committed Oct 30, 2023
1 parent 7a09854 commit cec3fc2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions dpdata/plugins/cp2k.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ 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]
return tuple(Cp2kSystems(log_file, xyz_file, restart))
except:
raise PendingDeprecationWarning(string_warning)
except (StopIteration, RuntimeError):

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)

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 @@ -43,5 +44,8 @@ def from_labeled_system(self, file_name, restart=False, **kwargs):
if tmp_virial is not None:
data["virials"] = tmp_virial
return data
except:
raise PendingDeprecationWarning(string_warning)
#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)

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 cec3fc2

Please sign in to comment.