Skip to content

Commit

Permalink
Try fixing pytest to <8.2 (odd failure in one GitHub action test …
Browse files Browse the repository at this point in the history
…with no error message?)
  • Loading branch information
kavanase committed May 11, 2024
1 parent 65adca3 commit 302884d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
14 changes: 7 additions & 7 deletions doped/chemical_potentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,16 +380,16 @@ def __init__(self, composition, e_above_hull=0.1, api_key=None, full_phase_diagr
# test api_key:
if self.api_key is None: # no API key supplied or set in ``.pmgrc.yaml``
raise ValueError(
"No API key (``api_key`` parameter or 'PMG_MAPI_KEY' in the ``~/.pmgrc.yaml`` or "
"``~/.config/.pmgrc.yaml file) was supplied. This is required for automatic competing "
"No API key (either ``api_key`` parameter or 'PMG_MAPI_KEY' in ``~/.pmgrc.yaml`` or "
"``~/.config/.pmgrc.yaml``) was supplied. This is required for automatic competing "
"phase generation in doped, as detailed on the installation instructions:\n"
"https://doped.readthedocs.io/en/latest/Installation.html#setup-potcars-and-materials"
"-project-api"
)
if len(self.api_key) == 32:
raise ValueError(
f"The supplied API key (``api_key`` or 'PMG_MAPI_KEY' in your ``~/.pmgrc.yaml`` or "
f"``~/.config/.pmgrc.yaml file; {self.api_key}) corresponds to the new Materials Project "
f"The supplied API key (either ``api_key`` or 'PMG_MAPI_KEY' in ``~/.pmgrc.yaml`` or "
f"``~/.config/.pmgrc.yaml``; {self.api_key}) corresponds to the new Materials Project "
f"(MP) API, which is not supported by doped. Please use the legacy MP API as detailed on "
f"the doped installation instructions:\n"
f"https://doped.readthedocs.io/en/latest/Installation.html#setup-potcars-and-materials"
Expand All @@ -399,8 +399,8 @@ def __init__(self, composition, e_above_hull=0.1, api_key=None, full_phase_diagr
self.eah = "e_above_hull"
else:
raise ValueError(
f"The supplied API key (``api_key`` or 'PMG_MAPI_KEY' in your ``~/.pmgrc.yaml`` or "
f"``~/.config/.pmgrc.yaml file; {self.api_key}) is not a valid legacy Materials Project "
f"The supplied API key (either ``api_key`` or 'PMG_MAPI_KEY' in ``~/.pmgrc.yaml`` or "
f"``~/.config/.pmgrc.yaml``; {self.api_key}) is not a valid legacy Materials Project "
f"API key, which is required by doped. See the doped installation instructions for "
f"details:\n"
"https://doped.readthedocs.io/en/latest/Installation.html#setup-potcars-and-materials"
Expand Down Expand Up @@ -1678,7 +1678,7 @@ def _calculate_extrinsic_chempot_lims(self, extrinsic_formation_energies, chempo
new_vals = list(self._intrinsic_chempots["limits_wrt_el_refs"].values())[i]
new_vals[f"{self.extrinsic_species}"] = d[f"{self.extrinsic_species}"]
cl2["limits_wrt_el_refs"][key] = new_vals
print(f"cl2: {cl2}") # debugging
# print(f"cl2: {cl2}") # debugging

# relate the limits to the elemental
# energies but in reverse this time
Expand Down
5 changes: 4 additions & 1 deletion doped/utils/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,10 @@ def _get_output_files_and_check_if_multiple(output_file="vasprun.xml", path=".")
):
output_path = os.path.join(path, output_files[0])
return (output_path, True) if len(output_files) > 1 else (output_path, False)
return f"{path}/{output_file}", False # so `get_X()` will raise an informative FileNotFoundError
return (
os.path.join(path, output_file),
False,
) # so `get_X()` will raise an informative FileNotFoundError


def get_defect_type_and_composition_diff(bulk, defect):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Package = "https://pypi.org/project/doped/"
Repository = "https://github.com/SMTG-Bham/doped"

[project.optional-dependencies]
tests = ["pytest>=7.1.3", "pytest-mpl>=0.16.1"]
tests = ["pytest<8.2", "pytest-mpl>=0.16.1"]
docs = ["sphinx", "sphinx-book-theme", "sphinx_design"]
analysis = [
"easyunfold",
Expand Down

0 comments on commit 302884d

Please sign in to comment.