From 1abc45936f839369854399369bc966732f85bf08 Mon Sep 17 00:00:00 2001 From: "Haoyu (Daniel) YANG" Date: Wed, 1 Jan 2025 06:18:28 +0800 Subject: [PATCH] Bump `phonopy` to apply fix for NumPy 2 in Windows (#4227) * install phonopy from git repo dev branch * unskip failing tests * remove python < 3.10 check * bump phonopy to test windows np2 fix --- pyproject.toml | 2 +- tests/io/test_phonopy.py | 9 --------- tests/util/test_typing.py | 8 -------- 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index db6f4b52ee6..cc7ff402087 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -107,7 +107,7 @@ optional = [ "hiphive>=1.3.1", "jarvis-tools>=2020.7.14", "matplotlib>=3.8", - "phonopy>=2.23", + "phonopy>=2.33.3", "seekpath>=2.0.1", ] # tblite only support Python 3.12+ through conda-forge diff --git a/tests/io/test_phonopy.py b/tests/io/test_phonopy.py index 0f20d54e474..14848c11bbb 100644 --- a/tests/io/test_phonopy.py +++ b/tests/io/test_phonopy.py @@ -1,7 +1,6 @@ from __future__ import annotations import os -import platform from pathlib import Path from unittest import TestCase @@ -124,10 +123,6 @@ def test_structure_conversion(self): assert struct_pmg_round_trip.site_properties["magmom"] == struct_pmg.site_properties["magmom"] -@pytest.mark.skipif( - platform.system() == "Windows" and int(np.__version__[0]) >= 2, - reason="cannot run NP2 on windows, see PR 4224", -) @pytest.mark.skipif(Phonopy is None, reason="Phonopy not present") class TestGetDisplacedStructures(PymatgenTest): def test_get_displaced_structures(self): @@ -160,10 +155,6 @@ def test_get_displaced_structures(self): assert os.path.isfile("test.yaml") -@pytest.mark.skipif( - platform.system() == "Windows" and int(np.__version__[0]) >= 2, - reason="cannot run NP2 on windows, see PR 4224", -) @pytest.mark.skipif(Phonopy is None, reason="Phonopy not present") class TestPhonopyFromForceConstants(TestCase): def setUp(self) -> None: diff --git a/tests/util/test_typing.py b/tests/util/test_typing.py index 2fe5592605c..c0dd731fb55 100644 --- a/tests/util/test_typing.py +++ b/tests/util/test_typing.py @@ -2,13 +2,10 @@ from __future__ import annotations -import sys from pathlib import Path from types import GenericAlias from typing import TYPE_CHECKING, get_args -import pytest - from pymatgen.core import Composition, DummySpecies, Element, Species from pymatgen.entries import Entry from pymatgen.util.typing import CompositionLike, EntryLike, PathLike, PbcLike, SpeciesLike @@ -20,8 +17,6 @@ __date__ = "2022-10-20" __email__ = "janosh@lbl.gov" -skip_below_py310 = pytest.mark.skipif(sys.version_info < (3, 10), reason="requires python 3.10 or higher") - def _type_str(some_type: Any) -> str: return str(some_type).replace("typing.", "").replace("pymatgen.core.periodic_table.", "") @@ -48,7 +43,6 @@ def test_entry_like(): assert Entry.__name__ in str(EntryLike) -@skip_below_py310 def test_species_like(): assert isinstance("H", SpeciesLike) assert isinstance(Element("H"), SpeciesLike) @@ -56,7 +50,6 @@ def test_species_like(): assert isinstance(DummySpecies("X"), SpeciesLike) -@skip_below_py310 def test_composition_like(): assert isinstance("H", CompositionLike) assert isinstance(Element("H"), CompositionLike) @@ -71,7 +64,6 @@ def test_pbc_like(): assert get_args(PbcLike) == (bool, bool, bool) -@skip_below_py310 def test_pathlike(): assert isinstance("path/to/file", PathLike) assert isinstance(Path("path/to/file"), PathLike)