From 98f7fc7df9ed1212a034e7a21dff5bac845ef7bc Mon Sep 17 00:00:00 2001 From: "Haoyu (Daniel)" Date: Wed, 4 Dec 2024 23:25:08 +0800 Subject: [PATCH] global replace inheritance from PymatgenTest --- tests/alchemy/test_filters.py | 4 +- tests/alchemy/test_materials.py | 2 +- tests/alchemy/test_transmuters.py | 4 +- .../connectivity/test_connected_components.py | 2 +- .../connectivity/test_environment_nodes.py | 2 +- .../test_structure_connectivity.py | 2 +- .../test_chemenv_strategies.py | 2 +- .../test_coordination_geometries.py | 2 +- .../test_coordination_geometry_finder.py | 2 +- .../test_read_write.py | 2 +- .../test_structure_environments.py | 2 +- .../coordination_environments/test_voronoi.py | 2 +- .../coordination_environments/test_weights.py | 2 +- .../chemenv/utils/test_chemenv_config.py | 2 +- .../utils/test_coordination_geometry_utils.py | 2 +- .../chemenv/utils/test_graph_utils.py | 4 +- .../analysis/chemenv/utils/test_math_utils.py | 2 +- tests/analysis/diffraction/test_neutron.py | 2 +- tests/analysis/diffraction/test_tem.py | 2 +- tests/analysis/diffraction/test_xrd.py | 2 +- tests/analysis/elasticity/test_elastic.py | 8 +-- tests/analysis/elasticity/test_strain.py | 6 +-- tests/analysis/elasticity/test_stress.py | 2 +- .../ferroelectricity/test_polarization.py | 6 +-- .../interfaces/test_coherent_interface.py | 2 +- tests/analysis/interfaces/test_zsl.py | 2 +- tests/analysis/solar/test_slme.py | 2 +- .../structure_prediction/test_substitutor.py | 2 +- .../test_volume_predictor.py | 4 +- tests/analysis/test_adsorption.py | 2 +- tests/analysis/test_bond_valence.py | 4 +- tests/analysis/test_chempot_diagram.py | 2 +- tests/analysis/test_dimensionality.py | 6 +-- tests/analysis/test_disorder.py | 2 +- tests/analysis/test_eos.py | 2 +- tests/analysis/test_fragmenter.py | 2 +- tests/analysis/test_graphs.py | 2 +- tests/analysis/test_local_env.py | 28 +++++----- tests/analysis/test_nmr.py | 4 +- tests/analysis/test_phase_diagram.py | 2 +- tests/analysis/test_piezo.py | 2 +- tests/analysis/test_piezo_sensitivity.py | 2 +- tests/analysis/test_pourbaix_diagram.py | 2 +- tests/analysis/test_prototypes.py | 2 +- tests/analysis/test_structure_analyzer.py | 6 +-- tests/analysis/test_structure_matcher.py | 2 +- tests/analysis/test_surface_analysis.py | 8 +-- tests/analysis/test_transition_state.py | 2 +- tests/analysis/test_wulff.py | 2 +- tests/analysis/test_xps.py | 2 +- tests/analysis/topological/test_spillage.py | 2 +- tests/analysis/xas/test_spectrum.py | 2 +- tests/apps/battery/test_analyzer.py | 2 +- tests/command_line/test_bader_caller.py | 2 +- tests/command_line/test_enumlib_caller.py | 2 +- tests/command_line/test_mcsqs_caller.py | 2 +- tests/command_line/test_vampire_caller.py | 2 +- tests/core/test_composition.py | 2 +- tests/core/test_interface.py | 6 +-- tests/core/test_lattice.py | 2 +- tests/core/test_libxcfunc.py | 2 +- tests/core/test_molecular_orbitals.py | 2 +- tests/core/test_operations.py | 4 +- tests/core/test_periodic_table.py | 4 +- tests/core/test_sites.py | 4 +- tests/core/test_spectrum.py | 2 +- tests/core/test_structure.py | 10 ++-- tests/core/test_surface.py | 8 +-- tests/core/test_tensors.py | 6 +-- tests/core/test_trajectory.py | 2 +- tests/core/test_units.py | 8 +-- tests/core/test_xcfunc.py | 2 +- .../test_bandstructure.py | 6 +-- tests/electronic_structure/test_cohp.py | 2 +- tests/electronic_structure/test_dos.py | 2 +- tests/electronic_structure/test_plotter.py | 6 +-- tests/entries/test_entry_tools.py | 4 +- tests/ext/test_matproj.py | 4 +- tests/ext/test_optimade.py | 2 +- tests/io/abinit/test_abiobjects.py | 16 +++--- tests/io/abinit/test_inputs.py | 8 +-- tests/io/abinit/test_netcdf.py | 4 +- tests/io/abinit/test_pseudos.py | 4 +- tests/io/cp2k/test_inputs.py | 8 +-- tests/io/cp2k/test_sets.py | 2 +- tests/io/exciting/test_inputs.py | 2 +- tests/io/feff/test_sets.py | 2 +- tests/io/lammps/test_data.py | 6 +-- tests/io/lammps/test_generators.py | 2 +- tests/io/lammps/test_inputs.py | 8 +-- tests/io/lobster/test_inputs.py | 4 +- tests/io/lobster/test_outputs.py | 20 +++---- tests/io/pwmat/test_inputs.py | 8 +-- tests/io/pwmat/test_outputs.py | 8 +-- tests/io/qchem/test_inputs.py | 2 +- tests/io/qchem/test_outputs.py | 2 +- tests/io/qchem/test_sets.py | 14 ++--- tests/io/qchem/test_utils.py | 2 +- tests/io/test_adf.py | 2 +- tests/io/test_atat.py | 2 +- tests/io/test_cif.py | 6 +-- tests/io/test_core.py | 4 +- tests/io/test_lmto.py | 4 +- tests/io/test_packmol.py | 2 +- tests/io/test_phonopy.py | 8 +-- tests/io/test_pwscf.py | 4 +- tests/io/test_shengbte.py | 2 +- tests/io/test_template_input.py | 2 +- tests/io/test_wannier90.py | 2 +- tests/io/test_xcrysden.py | 2 +- tests/io/vasp/test_inputs.py | 8 +-- tests/io/vasp/test_optics.py | 2 +- tests/io/vasp/test_outputs.py | 26 +++++----- tests/io/vasp/test_sets.py | 52 +++++++++---------- tests/io/xtb/test_inputs.py | 2 +- tests/io/xtb/test_outputs.py | 2 +- tests/optimization/test_neighbors.py | 2 +- tests/phonon/test_bandstructure.py | 2 +- tests/phonon/test_dos.py | 4 +- tests/phonon/test_gruneisen.py | 4 +- tests/phonon/test_ir_spectra.py | 2 +- tests/phonon/test_thermal_displacements.py | 2 +- tests/symmetry/test_analyzer.py | 4 +- tests/symmetry/test_kpath_hin.py | 2 +- tests/symmetry/test_kpath_lm.py | 2 +- tests/symmetry/test_kpath_sc.py | 2 +- tests/symmetry/test_kpaths.py | 2 +- tests/symmetry/test_maggroups.py | 2 +- tests/symmetry/test_site_symmetries.py | 2 +- .../test_advanced_transformations.py | 22 ++++---- .../test_site_transformations.py | 6 +-- tests/util/test_io.py | 2 +- tests/util/test_plotting.py | 2 +- tests/vis/test_plotters.py | 2 +- 134 files changed, 295 insertions(+), 295 deletions(-) diff --git a/tests/alchemy/test_filters.py b/tests/alchemy/test_filters.py index a5bcc72ea10..f068db3cf91 100644 --- a/tests/alchemy/test_filters.py +++ b/tests/alchemy/test_filters.py @@ -16,7 +16,7 @@ from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest -class TestContainsSpecieFilter(PymatgenTest): +class TestContainsSpecieFilter(MatSciTest): def test_filtering(self): coords = [[0, 0, 0], [0.75, 0.75, 0.75], [0.5, 0.5, 0.5], [0.25, 0.25, 0.25]] lattice = Lattice([[3.0, 0.0, 0.0], [1.0, 3.0, 0], [0, -2.0, 3.0]]) @@ -51,7 +51,7 @@ def test_as_from_dict(self): assert isinstance(ContainsSpecieFilter.from_dict(dct), ContainsSpecieFilter) -class TestSpecieProximityFilter(PymatgenTest): +class TestSpecieProximityFilter(MatSciTest): def test_filter(self): struct = self.get_structure("Li10GeP2S12") sf = SpecieProximityFilter({"Li": 1}) diff --git a/tests/alchemy/test_materials.py b/tests/alchemy/test_materials.py index 1e946163473..10115842f8f 100644 --- a/tests/alchemy/test_materials.py +++ b/tests/alchemy/test_materials.py @@ -21,7 +21,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/alchemy" -class TestTransformedStructure(PymatgenTest): +class TestTransformedStructure(MatSciTest): def setup_method(self): structure = PymatgenTest.get_structure("LiFePO4") self.structure = structure diff --git a/tests/alchemy/test_transmuters.py b/tests/alchemy/test_transmuters.py index 653a98c5326..fa249c2d500 100644 --- a/tests/alchemy/test_transmuters.py +++ b/tests/alchemy/test_transmuters.py @@ -11,7 +11,7 @@ from pymatgen.util.testing import TEST_FILES_DIR, VASP_IN_DIR, PymatgenTest -class TestCifTransmuter(PymatgenTest): +class TestCifTransmuter(MatSciTest): def test_init(self): trafos = [SubstitutionTransformation({"Fe": "Mn", "Fe2+": "Mn2+"})] tsc = CifTransmuter.from_filenames([f"{TEST_FILES_DIR}/cif/MultiStructure.cif"], trafos) @@ -22,7 +22,7 @@ def test_init(self): assert expected == els -class TestPoscarTransmuter(PymatgenTest): +class TestPoscarTransmuter(MatSciTest): def test_init(self): trafos = [SubstitutionTransformation({"Fe": "Mn"})] tsc = PoscarTransmuter.from_filenames([f"{VASP_IN_DIR}/POSCAR", f"{VASP_IN_DIR}/POSCAR"], trafos) diff --git a/tests/analysis/chemenv/connectivity/test_connected_components.py b/tests/analysis/chemenv/connectivity/test_connected_components.py index fc9e561c57e..915f0bf1bae 100644 --- a/tests/analysis/chemenv/connectivity/test_connected_components.py +++ b/tests/analysis/chemenv/connectivity/test_connected_components.py @@ -25,7 +25,7 @@ __author__ = "waroquiers" -class TestConnectedComponent(PymatgenTest): +class TestConnectedComponent(MatSciTest): def test_init(self): # Generic connected component not using EnvironmentNodes # (as_dict won't work on such a ConnectedComponent instance) diff --git a/tests/analysis/chemenv/connectivity/test_environment_nodes.py b/tests/analysis/chemenv/connectivity/test_environment_nodes.py index 60af01acff7..dc7956ab764 100644 --- a/tests/analysis/chemenv/connectivity/test_environment_nodes.py +++ b/tests/analysis/chemenv/connectivity/test_environment_nodes.py @@ -13,7 +13,7 @@ __author__ = "waroquiers" -class TestEnvironmentNodes(PymatgenTest): +class TestEnvironmentNodes(MatSciTest): def test_equal(self): struct = self.get_structure("SiO2") en = EnvironmentNode(central_site=struct[0], i_central_site=0, ce_symbol="T:4") diff --git a/tests/analysis/chemenv/connectivity/test_structure_connectivity.py b/tests/analysis/chemenv/connectivity/test_structure_connectivity.py index 37f8da4b98a..604f3018744 100644 --- a/tests/analysis/chemenv/connectivity/test_structure_connectivity.py +++ b/tests/analysis/chemenv/connectivity/test_structure_connectivity.py @@ -14,7 +14,7 @@ __author__ = "waroquiers" -class TestStructureConnectivity(PymatgenTest): +class TestStructureConnectivity(MatSciTest): def test_serialization(self): BaTiO3_se_fpath = f"{TEST_FILES_DIR}/analysis/chemenv/structure_environments/se_mp-5020.json" with open(BaTiO3_se_fpath) as file: diff --git a/tests/analysis/chemenv/coordination_environments/test_chemenv_strategies.py b/tests/analysis/chemenv/coordination_environments/test_chemenv_strategies.py index 64516b22c41..d7cd8a2a474 100644 --- a/tests/analysis/chemenv/coordination_environments/test_chemenv_strategies.py +++ b/tests/analysis/chemenv/coordination_environments/test_chemenv_strategies.py @@ -15,7 +15,7 @@ __author__ = "waroquiers" -class TestStrategyOptions(PymatgenTest): +class TestStrategyOptions(MatSciTest): def test_options(self): # DistanceCutoffFloat with pytest.raises(ValueError, match=r"Distance cutoff should be between 1 and \+infinity"): diff --git a/tests/analysis/chemenv/coordination_environments/test_coordination_geometries.py b/tests/analysis/chemenv/coordination_environments/test_coordination_geometries.py index 18fc1675835..e07ead94557 100644 --- a/tests/analysis/chemenv/coordination_environments/test_coordination_geometries.py +++ b/tests/analysis/chemenv/coordination_environments/test_coordination_geometries.py @@ -23,7 +23,7 @@ def __init__(self, coords): self.coords = coords -class TestCoordinationGeometries(PymatgenTest): +class TestCoordinationGeometries(MatSciTest): def test_algorithms(self): expl_algo = ExplicitPermutationsAlgorithm(permutations=[[0, 1, 2], [1, 2, 3]]) expl_algo2 = ExplicitPermutationsAlgorithm.from_dict(expl_algo.as_dict()) diff --git a/tests/analysis/chemenv/coordination_environments/test_coordination_geometry_finder.py b/tests/analysis/chemenv/coordination_environments/test_coordination_geometry_finder.py index 74120fa0d94..d518fd0d466 100644 --- a/tests/analysis/chemenv/coordination_environments/test_coordination_geometry_finder.py +++ b/tests/analysis/chemenv/coordination_environments/test_coordination_geometry_finder.py @@ -26,7 +26,7 @@ json_dir = f"{TEST_FILES_DIR}/analysis/chemenv/json" -class TestCoordinationGeometryFinder(PymatgenTest): +class TestCoordinationGeometryFinder(MatSciTest): def setup_method(self): self.lgf = LocalGeometryFinder() self.lgf.setup_parameters( diff --git a/tests/analysis/chemenv/coordination_environments/test_read_write.py b/tests/analysis/chemenv/coordination_environments/test_read_write.py index dba1f04b070..f1be06c44ca 100644 --- a/tests/analysis/chemenv/coordination_environments/test_read_write.py +++ b/tests/analysis/chemenv/coordination_environments/test_read_write.py @@ -30,7 +30,7 @@ struct_env_dir = f"{TEST_FILES_DIR}/analysis/chemenv/structure_environments" -class TestReadWriteChemenv(PymatgenTest): +class TestReadWriteChemenv(MatSciTest): @classmethod def setup_class(cls): cls.lgf = LocalGeometryFinder() diff --git a/tests/analysis/chemenv/coordination_environments/test_structure_environments.py b/tests/analysis/chemenv/coordination_environments/test_structure_environments.py index 3f8bde41636..16fa2a4d16e 100644 --- a/tests/analysis/chemenv/coordination_environments/test_structure_environments.py +++ b/tests/analysis/chemenv/coordination_environments/test_structure_environments.py @@ -24,7 +24,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/analysis/chemenv/structure_environments" -class TestStructureEnvironments(PymatgenTest): +class TestStructureEnvironments(MatSciTest): def test_structure_environments(self): with open(f"{TEST_DIR}/se_mp-7000.json") as file: dct = json.load(file) diff --git a/tests/analysis/chemenv/coordination_environments/test_voronoi.py b/tests/analysis/chemenv/coordination_environments/test_voronoi.py index 492cc00df36..60dafdf3af9 100644 --- a/tests/analysis/chemenv/coordination_environments/test_voronoi.py +++ b/tests/analysis/chemenv/coordination_environments/test_voronoi.py @@ -12,7 +12,7 @@ img_files_dir = f"{TEST_FILES_DIR}/analysis/chemenv/images" -class TestVoronoiContainer(PymatgenTest): +class TestVoronoiContainer(MatSciTest): def test_voronoi(self): # Define a cubic lattice and a list of species (to be used for the fake structures) cubic_lattice = Lattice.cubic(10) diff --git a/tests/analysis/chemenv/coordination_environments/test_weights.py b/tests/analysis/chemenv/coordination_environments/test_weights.py index 6a5b2ffe50a..586af7a31bf 100644 --- a/tests/analysis/chemenv/coordination_environments/test_weights.py +++ b/tests/analysis/chemenv/coordination_environments/test_weights.py @@ -39,7 +39,7 @@ class DummyVoronoiContainer: pass -class StrategyWeights(PymatgenTest): +class StrategyWeights(MatSciTest): def test_angle_weight(self): fake_nb_set = FakeNbSet() dummy_se = DummyStructureEnvironments() diff --git a/tests/analysis/chemenv/utils/test_chemenv_config.py b/tests/analysis/chemenv/utils/test_chemenv_config.py index bea8a66770f..1c3efa2c8c4 100644 --- a/tests/analysis/chemenv/utils/test_chemenv_config.py +++ b/tests/analysis/chemenv/utils/test_chemenv_config.py @@ -9,7 +9,7 @@ config_file_dir = f"{TEST_FILES_DIR}/analysis/chemenv/config" -class TestChemenvConfig(PymatgenTest): +class TestChemenvConfig(MatSciTest): def test_chemenv_config(self): config = ChemEnvConfig() diff --git a/tests/analysis/chemenv/utils/test_coordination_geometry_utils.py b/tests/analysis/chemenv/utils/test_coordination_geometry_utils.py index 60801c5a0b6..9b459d736e2 100644 --- a/tests/analysis/chemenv/utils/test_coordination_geometry_utils.py +++ b/tests/analysis/chemenv/utils/test_coordination_geometry_utils.py @@ -12,7 +12,7 @@ __author__ = "David Waroquiers" -class TestPlanesUtils(PymatgenTest): +class TestPlanesUtils(MatSciTest): def setup_method(self): # Test of plane 4x + 2y - 4z + 3 = 0 (used in most test cases) self.expected_coefficients = np.array([4, 2, -4, 3], float) diff --git a/tests/analysis/chemenv/utils/test_graph_utils.py b/tests/analysis/chemenv/utils/test_graph_utils.py index b5f32fe7e94..25a791d1e1b 100644 --- a/tests/analysis/chemenv/utils/test_graph_utils.py +++ b/tests/analysis/chemenv/utils/test_graph_utils.py @@ -68,7 +68,7 @@ def __lt__(self, other): return self.isite % 2 < other.isite % 2 -class TestGraphUtils(PymatgenTest): +class TestGraphUtils(MatSciTest): def test_get_delta(self): n1 = FakeNode(3) n2 = FakeNode(7) @@ -664,7 +664,7 @@ def test_multigraph_cycle(self): assert mgc.edge_indices == edges_ref, f"Edges not equal for inodes = ({str_nodes})" -class TestEnvironmentNodesGraphUtils(PymatgenTest): +class TestEnvironmentNodesGraphUtils(MatSciTest): def test_cycle(self): e1 = EnvironmentNode(central_site="Si", i_central_site=0, ce_symbol="T:4") e2 = EnvironmentNode(central_site="Si", i_central_site=3, ce_symbol="T:4") diff --git a/tests/analysis/chemenv/utils/test_math_utils.py b/tests/analysis/chemenv/utils/test_math_utils.py index d3583a24851..184f3364a26 100644 --- a/tests/analysis/chemenv/utils/test_math_utils.py +++ b/tests/analysis/chemenv/utils/test_math_utils.py @@ -21,7 +21,7 @@ __author__ = "waroquiers" -class TestMathUtils(PymatgenTest): +class TestMathUtils(MatSciTest): def test_list_cartesian_product(self): list_of_lists = [[0, 1], [2, 5, 4], [5]] assert _cartesian_product(lists=list_of_lists) == [ diff --git a/tests/analysis/diffraction/test_neutron.py b/tests/analysis/diffraction/test_neutron.py index 4de897d85d6..eb031175743 100644 --- a/tests/analysis/diffraction/test_neutron.py +++ b/tests/analysis/diffraction/test_neutron.py @@ -20,7 +20,7 @@ __date__ = "4/19/18" -class TestNDCalculator(PymatgenTest): +class TestNDCalculator(MatSciTest): def test_get_pattern(self): struct = self.get_structure("CsCl") c = NDCalculator(wavelength=1.54184) # CuKa radiation diff --git a/tests/analysis/diffraction/test_tem.py b/tests/analysis/diffraction/test_tem.py index c8cfee3b1d5..2e491e6b486 100644 --- a/tests/analysis/diffraction/test_tem.py +++ b/tests/analysis/diffraction/test_tem.py @@ -21,7 +21,7 @@ __date__ = "2/20/20" -class TestTEMCalculator(PymatgenTest): +class TestTEMCalculator(MatSciTest): def test_wavelength_rel(self): # Test that the relativistic wavelength formula (for 200 kV electron beam) is correct tem_calc = TEMCalculator() diff --git a/tests/analysis/diffraction/test_xrd.py b/tests/analysis/diffraction/test_xrd.py index 997c43de42b..ce2e13851f0 100644 --- a/tests/analysis/diffraction/test_xrd.py +++ b/tests/analysis/diffraction/test_xrd.py @@ -16,7 +16,7 @@ __date__ = "5/22/14" -class TestXRDCalculator(PymatgenTest): +class TestXRDCalculator(MatSciTest): def test_type_wavelength(self): """Test TypeError is raised if wavelength is unaccepted type.""" wavelength = [1.78, 2.78] # just a list diff --git a/tests/analysis/elasticity/test_elastic.py b/tests/analysis/elasticity/test_elastic.py index 97917144d2e..788ce69d13e 100644 --- a/tests/analysis/elasticity/test_elastic.py +++ b/tests/analysis/elasticity/test_elastic.py @@ -32,7 +32,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/analysis/elasticity" -class TestElasticTensor(PymatgenTest): +class TestElasticTensor(MatSciTest): def setup_method(self): self.voigt_1 = [ [59.33, 28.08, 28.08, 0, 0, 0], @@ -263,7 +263,7 @@ def test_energy_density(self): ) -class TestElasticTensorExpansion(PymatgenTest): +class TestElasticTensorExpansion(MatSciTest): def setup_method(self): with open(f"{TEST_DIR}/test_toec_data.json") as file: self.data_dict = json.load(file) @@ -364,7 +364,7 @@ def test_get_yield_stress(self): self.exp_cu_4.get_yield_stress([1, 0, 0]) -class TestNthOrderElasticTensor(PymatgenTest): +class TestNthOrderElasticTensor(MatSciTest): def setup_method(self): with open(f"{TEST_DIR}/test_toec_data.json") as file: self.data_dict = json.load(file) @@ -401,7 +401,7 @@ def test_energy_density(self): self.c3.energy_density(self.strains[0]) -class TestDiffFit(PymatgenTest): +class TestDiffFit(MatSciTest): """Test various functions related to diff fitting.""" def setup_method(self): diff --git a/tests/analysis/elasticity/test_strain.py b/tests/analysis/elasticity/test_strain.py index 9b2daee68fb..56bab6cf982 100644 --- a/tests/analysis/elasticity/test_strain.py +++ b/tests/analysis/elasticity/test_strain.py @@ -10,7 +10,7 @@ from pymatgen.util.testing import PymatgenTest -class TestDeformation(PymatgenTest): +class TestDeformation(MatSciTest): def setup_method(self): self.norm_defo = Deformation.from_index_amount((0, 0), 0.02) self.ind_defo = Deformation.from_index_amount((0, 1), 0.02) @@ -81,7 +81,7 @@ def test_apply_to_structure(self): assert_allclose(new_coord, defo_coord) -class TestStrain(PymatgenTest): +class TestStrain(MatSciTest): def setup_method(self): self.norm_str = Strain.from_deformation([[1.02, 0, 0], [0, 1, 0], [0, 0, 1]]) self.ind_str = Strain.from_deformation([[1, 0.02, 0], [0, 1, 0], [0, 0, 1]]) @@ -142,7 +142,7 @@ def test_convert_strain_to_deformation(self): assert_allclose(defo.green_lagrange_strain, strain) -class TestDeformedStructureSet(PymatgenTest): +class TestDeformedStructureSet(MatSciTest): def setup_method(self): self.structure = self.get_structure("Sn") self.default_dss = DeformedStructureSet(self.structure) diff --git a/tests/analysis/elasticity/test_stress.py b/tests/analysis/elasticity/test_stress.py index 303c7d0f87c..f37192cf4c7 100644 --- a/tests/analysis/elasticity/test_stress.py +++ b/tests/analysis/elasticity/test_stress.py @@ -10,7 +10,7 @@ from pymatgen.util.testing import PymatgenTest -class TestStress(PymatgenTest): +class TestStress(MatSciTest): def setup_method(self): self.rand_stress = Stress(np.random.default_rng().standard_normal((3, 3))) self.symm_stress = Stress([[0.51, 2.29, 2.42], [2.29, 5.14, 5.07], [2.42, 5.07, 5.33]]) diff --git a/tests/analysis/ferroelectricity/test_polarization.py b/tests/analysis/ferroelectricity/test_polarization.py index f6fca157600..f1cc15358ae 100644 --- a/tests/analysis/ferroelectricity/test_polarization.py +++ b/tests/analysis/ferroelectricity/test_polarization.py @@ -38,7 +38,7 @@ ) -class TestUtils(PymatgenTest): +class TestUtils(MatSciTest): def setup_method(self): self.potcar = Potcar.from_file(f"{TEST_DIR}/POTCAR") self.zval_dict = {"Ba": 10, "Ti": 10, "O": 6} @@ -54,7 +54,7 @@ def test_get_total_ionic_dipole(self): assert_allclose(p_ion, self.ions[-1].ravel().tolist()) -class TestPolarization(PymatgenTest): +class TestPolarization(MatSciTest): def setup_method(self): self.p_ions = ions self.p_ions_outcar = np.array( @@ -258,7 +258,7 @@ def test_smoothness(self): assert_allclose(self.smoothness_all_in_polar, smoothness) -class TestEnergyTrend(PymatgenTest): +class TestEnergyTrend(MatSciTest): def setup_method(self): self.energies = [ -7.97738049, diff --git a/tests/analysis/interfaces/test_coherent_interface.py b/tests/analysis/interfaces/test_coherent_interface.py index 2b19cafd1cb..5ad0c9e78ec 100644 --- a/tests/analysis/interfaces/test_coherent_interface.py +++ b/tests/analysis/interfaces/test_coherent_interface.py @@ -17,7 +17,7 @@ from pymatgen.util.testing import PymatgenTest -class TestInterfaceBuilder(PymatgenTest): +class TestInterfaceBuilder(MatSciTest): @classmethod def setup_class(cls): si_struct = cls.get_structure("Si") diff --git a/tests/analysis/interfaces/test_zsl.py b/tests/analysis/interfaces/test_zsl.py index 3030a3d3074..c18a6042fc7 100644 --- a/tests/analysis/interfaces/test_zsl.py +++ b/tests/analysis/interfaces/test_zsl.py @@ -23,7 +23,7 @@ __date__ = "2/5/16" -class TestZSLGen(PymatgenTest): +class TestZSLGen(MatSciTest): def setup_method(self): # Film VO2 self.film = SpacegroupAnalyzer(self.get_structure("VO2"), symprec=0.1).get_conventional_standard_structure() diff --git a/tests/analysis/solar/test_slme.py b/tests/analysis/solar/test_slme.py index 3ccf3256d11..e83ede5b062 100644 --- a/tests/analysis/solar/test_slme.py +++ b/tests/analysis/solar/test_slme.py @@ -8,7 +8,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/analysis/solar" -class TestSolar(PymatgenTest): +class TestSolar(MatSciTest): def test_slme_from_vasprun(self): en, abz, dir_gap, indir_gap = optics(f"{TEST_DIR}/vasprun.xml") abz *= 100.0 diff --git a/tests/analysis/structure_prediction/test_substitutor.py b/tests/analysis/structure_prediction/test_substitutor.py index 87ba7b2e787..a8626b5bf33 100644 --- a/tests/analysis/structure_prediction/test_substitutor.py +++ b/tests/analysis/structure_prediction/test_substitutor.py @@ -20,7 +20,7 @@ def get_table(): return json.load(file) -class TestSubstitutor(PymatgenTest): +class TestSubstitutor(MatSciTest): def setup_method(self): self.substitutor = Substitutor(threshold=1e-3, lambda_table=get_table(), alpha=-5.0) diff --git a/tests/analysis/structure_prediction/test_volume_predictor.py b/tests/analysis/structure_prediction/test_volume_predictor.py index 20ecf2bd24b..b94bf999a50 100644 --- a/tests/analysis/structure_prediction/test_volume_predictor.py +++ b/tests/analysis/structure_prediction/test_volume_predictor.py @@ -10,7 +10,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/analysis/structure_prediction" -class TestRLSVolumePredictor(PymatgenTest): +class TestRLSVolumePredictor(MatSciTest): def test_predict(self): struct = PymatgenTest.get_structure("CsCl") nacl = PymatgenTest.get_structure("CsCl") @@ -77,7 +77,7 @@ def test_modes(self): assert vol_pred.predict(cs_cl, na_cl) == approx(342.84905395082535) -class TestDLSVolumePredictor(PymatgenTest): +class TestDLSVolumePredictor(MatSciTest): def test_predict(self): vol_pred = DLSVolumePredictor() p_fast = DLSVolumePredictor(cutoff=0.0) # for speed on compressed cells diff --git a/tests/analysis/test_adsorption.py b/tests/analysis/test_adsorption.py index 1b90989c410..9bc84be4b83 100644 --- a/tests/analysis/test_adsorption.py +++ b/tests/analysis/test_adsorption.py @@ -11,7 +11,7 @@ from pymatgen.util.testing import PymatgenTest -class TestAdsorbateSiteFinder(PymatgenTest): +class TestAdsorbateSiteFinder(MatSciTest): def setup_method(self): self.structure = Structure.from_spacegroup("Fm-3m", Lattice.cubic(3.5), ["Ni"], [[0, 0, 0]]) lattice = Lattice.cubic(3.010) diff --git a/tests/analysis/test_bond_valence.py b/tests/analysis/test_bond_valence.py index 17c94ad404d..fb50139d78b 100644 --- a/tests/analysis/test_bond_valence.py +++ b/tests/analysis/test_bond_valence.py @@ -10,7 +10,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/analysis/bond_valence" -class TestBVAnalyzer(PymatgenTest): +class TestBVAnalyzer(MatSciTest): def setup_method(self): self.analyzer = BVAnalyzer() @@ -44,7 +44,7 @@ def test_get_oxi_state_structure(self): assert Species("Mn4+") in oxi_struct.composition.elements -class TestBondValenceSum(PymatgenTest): +class TestBondValenceSum(MatSciTest): def test_calculate_bv_sum(self): struct = Structure.from_file(f"{TEST_DIR}/LiMn2O4.json") neighbors = struct.get_neighbors(struct[0], 3.0) diff --git a/tests/analysis/test_chempot_diagram.py b/tests/analysis/test_chempot_diagram.py index 3c4a87b6262..1c6377db8f9 100644 --- a/tests/analysis/test_chempot_diagram.py +++ b/tests/analysis/test_chempot_diagram.py @@ -17,7 +17,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/analysis" -class TestChemicalPotentialDiagram(PymatgenTest): +class TestChemicalPotentialDiagram(MatSciTest): def setup_method(self): self.entries = EntrySet.from_csv(f"{TEST_DIR}/pd_entries_test.csv") self.cpd_ternary, self.cpd_ternary_formal = ( diff --git a/tests/analysis/test_dimensionality.py b/tests/analysis/test_dimensionality.py index 49482280d61..7f700969292 100644 --- a/tests/analysis/test_dimensionality.py +++ b/tests/analysis/test_dimensionality.py @@ -18,7 +18,7 @@ from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest -class TestLarsenDimensionality(PymatgenTest): +class TestLarsenDimensionality(MatSciTest): def setup_method(self): cnn = CrystalNN() self.lifepo = cnn.get_bonded_structure(self.get_structure("LiFePO4")) @@ -114,7 +114,7 @@ def test_zero_d_to_molecule_graph(self): assert len(mol_graph.molecule) == 12 -class TestCheonDimensionality(PymatgenTest): +class TestCheonDimensionality(MatSciTest): def test_get_dimensionality(self): struct = self.get_structure("LiFePO4") assert get_dimensionality_cheon(struct) == "intercalated ion" @@ -152,7 +152,7 @@ def test_tricky_structure(self): assert get_dimensionality_cheon(tricky_structure, larger_cell=True) == "3D" -class TestGoraiDimensionality(PymatgenTest): +class TestGoraiDimensionality(MatSciTest): def test_get_dimensionality(self): struct = self.get_structure("LiFePO4") assert get_dimensionality_gorai(struct) == 3 diff --git a/tests/analysis/test_disorder.py b/tests/analysis/test_disorder.py index f1fbd2f58d5..ab4a7a7b315 100644 --- a/tests/analysis/test_disorder.py +++ b/tests/analysis/test_disorder.py @@ -7,7 +7,7 @@ from pymatgen.util.testing import PymatgenTest -class TestOrderParameter(PymatgenTest): +class TestOrderParameter(MatSciTest): def test_compute_warren_cowley_parameters(self): struct = Structure.from_prototype("CsCl", ["Mo", "W"], a=4) aij = get_warren_cowley_parameters(struct, r=3.4, dr=0.3) diff --git a/tests/analysis/test_eos.py b/tests/analysis/test_eos.py index 9138fe905ab..a388440cc2b 100644 --- a/tests/analysis/test_eos.py +++ b/tests/analysis/test_eos.py @@ -8,7 +8,7 @@ from pymatgen.util.testing import PymatgenTest -class TestEOS(PymatgenTest): +class TestEOS(MatSciTest): def setup_method(self): # Si data from Cormac self.volumes = [ diff --git a/tests/analysis/test_fragmenter.py b/tests/analysis/test_fragmenter.py index be951ed19f0..477742b1132 100644 --- a/tests/analysis/test_fragmenter.py +++ b/tests/analysis/test_fragmenter.py @@ -17,7 +17,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/analysis/local_env/fragmenter_files" -class TestFragmentMolecule(PymatgenTest): +class TestFragmentMolecule(MatSciTest): @classmethod def setup_class(cls): cls.pc = Molecule.from_file(f"{TEST_DIR}/PC.xyz") diff --git a/tests/analysis/test_graphs.py b/tests/analysis/test_graphs.py index 89e4c4d1281..72b125aa12d 100644 --- a/tests/analysis/test_graphs.py +++ b/tests/analysis/test_graphs.py @@ -45,7 +45,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/analysis/graphs" -class TestStructureGraph(PymatgenTest): +class TestStructureGraph(MatSciTest): def setup_method(self): # trivial example, simple square lattice for testing structure = Structure(Lattice.tetragonal(5, 50), ["H"], [[0, 0, 0]]) diff --git a/tests/analysis/test_local_env.py b/tests/analysis/test_local_env.py index 039282e2cc3..8bf1e95e614 100644 --- a/tests/analysis/test_local_env.py +++ b/tests/analysis/test_local_env.py @@ -54,7 +54,7 @@ def test_opt_params(): assert cn_opt_params == CN_OPT_PARAMS -class TestValenceIonicRadiusEvaluator(PymatgenTest): +class TestValenceIonicRadiusEvaluator(MatSciTest): def setup_method(self): """Setup MgO rocksalt structure for testing Vacancy.""" mgo_latt = np.eye(3) * 4.212 @@ -89,7 +89,7 @@ def test_radii_ionic_structure(self): assert rad in {0.86, 1.26} -class TestVoronoiNN(PymatgenTest): +class TestVoronoiNN(MatSciTest): def setup_method(self): self.struct = self.get_structure("LiFePO4") self.nn = VoronoiNN(targets=[Element("O")]) @@ -260,7 +260,7 @@ def test_filtered(self): assert [len(x) for x in all_nns] == [8] * 16 -class TestJmolNN(PymatgenTest): +class TestJmolNN(MatSciTest): def setup_method(self): self.jmol = JmolNN() self.jmol_update = JmolNN(el_radius_updates={"Li": 1}) @@ -290,7 +290,7 @@ def test_get_nn(self): assert len(self.jmol_update.get_nn(struct, 0)) == 2 -class TestIsayevNN(PymatgenTest): +class TestIsayevNN(MatSciTest): def test_get_nn(self): inn = IsayevNN() struct = self.get_structure("LiFePO4") @@ -301,7 +301,7 @@ def test_get_nn(self): assert len(inn.get_nn(struct, 0)) == 2 -class TestOpenBabelNN(PymatgenTest): +class TestOpenBabelNN(MatSciTest): def setup_method(self): pytest.importorskip("openbabel") self.benzene = Molecule.from_file(f"{TEST_DIR}/../benzene.xyz") @@ -333,7 +333,7 @@ def test_nn_length(self): assert strategy.get_nn_info(self.acetylene, 0)[0]["weight"] == approx(1.19, abs=1e-2) -class TestCovalentBondNN(PymatgenTest): +class TestCovalentBondNN(MatSciTest): def setup_method(self): self.benzene = Molecule.from_file(f"{TEST_DIR}/../benzene.xyz") self.acetylene = Molecule.from_file(f"{TEST_FILES_DIR}/io/xyz/acetylene.xyz") @@ -372,7 +372,7 @@ def test_bonded_structure(self): assert len(acetylene.graph.nodes) == 4 -class TestMiniDistNN(PymatgenTest): +class TestMiniDistNN(MatSciTest): def setup_method(self): self.diamond = Structure( Lattice([[2.189, 0, 1.264], [0.73, 2.064, 1.264], [0, 0, 2.528]]), @@ -485,7 +485,7 @@ def test_get_local_order_params(self): assert ops["octahedral"] == approx(0.9999995266669) -class TestMotifIdentification(PymatgenTest): +class TestMotifIdentification(MatSciTest): def setup_method(self): self.silicon = Structure( Lattice.cubic(5.47), @@ -583,7 +583,7 @@ def test_get_neighbors_of_site_with_index(self): assert len(get_neighbors_of_site_with_index(self.diamond, 0, approach="min_VIRE")) == 4 -class TestNearNeighbor(PymatgenTest): +class TestNearNeighbor(MatSciTest): def setup_method(self): self.diamond = Structure( Lattice([[2.189, 0, 1.264], [0.73, 2.064, 1.264], [0, 0, 2.528]]), @@ -617,7 +617,7 @@ def test_on_disorder_options(self): ) -class TestLocalStructOrderParams(PymatgenTest): +class TestLocalStructOrderParams(MatSciTest): def setup_method(self): self.single_bond = Structure( Lattice.cubic(10), @@ -1182,7 +1182,7 @@ def test_get_order_parameters(self): ops_101.get_order_parameters(self.bcc, 0, indices_neighs=[2]) -class TestCrystalNN(PymatgenTest): +class TestCrystalNN(MatSciTest): def setup_method(self): self.lifepo4 = self.get_structure("LiFePO4") self.lifepo4.add_oxidation_state_by_guess() @@ -1329,7 +1329,7 @@ def test_get_bonded_structure(self): cnn.get_bonded_structure(self.disordered_struct, 0, on_disorder="error") -class TestCutOffDictNN(PymatgenTest): +class TestCutOffDictNN(MatSciTest): def setup_method(self): self.diamond = Structure( Lattice([[2.189, 0, 1.264], [0.73, 2.064, 1.264], [0, 0, 2.528]]), @@ -1355,7 +1355,7 @@ def test_from_preset(self): @pytest.mark.skipif(not which("critic2"), reason="critic2 executable not present") -class TestCritic2NN(PymatgenTest): +class TestCritic2NN(MatSciTest): def setup_method(self): self.diamond = Structure( Lattice([[2.189, 0, 1.264], [0.73, 2.064, 1.264], [0, 0, 2.528]]), @@ -1369,7 +1369,7 @@ def test_cn(self): # assert nn.get_cn(self.diamond, 0) == 4 -class TestMetalEdgeExtender(PymatgenTest): +class TestMetalEdgeExtender(MatSciTest): def setup_method(self): self.LiEC = Molecule.from_file(f"{TEST_DIR}/LiEC.xyz") self.phsh = Molecule.from_file(f"{TEST_DIR}/phsh.xyz") diff --git a/tests/analysis/test_nmr.py b/tests/analysis/test_nmr.py index 14490ec7a0c..b3f97fe2c3e 100644 --- a/tests/analysis/test_nmr.py +++ b/tests/analysis/test_nmr.py @@ -8,7 +8,7 @@ from pymatgen.util.testing import PymatgenTest -class TestChemicalShieldingNotation(PymatgenTest): +class TestChemicalShieldingNotation(MatSciTest): def test_construction(self): cs = ChemicalShielding(np.arange(9).reshape((3, 3))) assert cs.shape == (3, 3) @@ -46,7 +46,7 @@ def test_notations(self): assert mary1.kappa == approx(0.8337, abs=1e-5) -class TestElectricFieldGradient(PymatgenTest): +class TestElectricFieldGradient(MatSciTest): def test_construction(self): efg = ElectricFieldGradient(np.arange(9).reshape((3, 3))) assert efg.shape == (3, 3) diff --git a/tests/analysis/test_phase_diagram.py b/tests/analysis/test_phase_diagram.py index 25b84f2f7ca..61ee1930028 100644 --- a/tests/analysis/test_phase_diagram.py +++ b/tests/analysis/test_phase_diagram.py @@ -178,7 +178,7 @@ def test_normalize(self): assert norm_entry.composition == expected_comp -class TestPhaseDiagram(PymatgenTest): +class TestPhaseDiagram(MatSciTest): def setup_method(self): self.entries = EntrySet.from_csv(f"{TEST_DIR}/pd_entries_test.csv") self.pd = PhaseDiagram(self.entries) diff --git a/tests/analysis/test_piezo.py b/tests/analysis/test_piezo.py index 59eb96e5996..42d659976c1 100644 --- a/tests/analysis/test_piezo.py +++ b/tests/analysis/test_piezo.py @@ -17,7 +17,7 @@ __date__ = "4/1/16" -class TestPiezo(PymatgenTest): +class TestPiezo(MatSciTest): def setup_method(self): self.piezo_struct = self.get_structure("BaNiO3") self.voigt_matrix = np.array( diff --git a/tests/analysis/test_piezo_sensitivity.py b/tests/analysis/test_piezo_sensitivity.py index 454f1caed77..bf9c10ffcf5 100644 --- a/tests/analysis/test_piezo_sensitivity.py +++ b/tests/analysis/test_piezo_sensitivity.py @@ -34,7 +34,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/analysis/piezo_sensitivity" -class TestPiezoSensitivity(PymatgenTest): +class TestPiezoSensitivity(MatSciTest): def setup_method(self): self.piezo_struct = self.get_structure("Pb2TiZrO6") self.IST = np.load(f"{TEST_DIR}/pztist.npy", allow_pickle=True) diff --git a/tests/analysis/test_pourbaix_diagram.py b/tests/analysis/test_pourbaix_diagram.py index 77f71721327..38fce08fa90 100644 --- a/tests/analysis/test_pourbaix_diagram.py +++ b/tests/analysis/test_pourbaix_diagram.py @@ -16,7 +16,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/analysis/pourbaix_diagram" -class TestPourbaixEntry(PymatgenTest): +class TestPourbaixEntry(MatSciTest): """Test all functions using a fictitious entry""" def setup_method(self): diff --git a/tests/analysis/test_prototypes.py b/tests/analysis/test_prototypes.py index d2a16258d03..acf8b8472fd 100644 --- a/tests/analysis/test_prototypes.py +++ b/tests/analysis/test_prototypes.py @@ -4,7 +4,7 @@ from pymatgen.util.testing import PymatgenTest -class TestAflowPrototypeMatcher(PymatgenTest): +class TestAflowPrototypeMatcher(MatSciTest): def test_prototype_matching(self): af = AflowPrototypeMatcher() diff --git a/tests/analysis/test_structure_analyzer.py b/tests/analysis/test_structure_analyzer.py index d92b954f79a..35463013dce 100644 --- a/tests/analysis/test_structure_analyzer.py +++ b/tests/analysis/test_structure_analyzer.py @@ -19,7 +19,7 @@ from pymatgen.util.testing import VASP_IN_DIR, VASP_OUT_DIR, PymatgenTest -class TestVoronoiAnalyzer(PymatgenTest): +class TestVoronoiAnalyzer(MatSciTest): def setup_method(self): self.structs = Xdatcar(f"{VASP_OUT_DIR}/XDATCAR.MD").structures self.struct = self.structs[1] @@ -60,7 +60,7 @@ def test_get_percentage_bond_dist_changes(self): assert approx(v2) == -0.009204092115527862 -class TestVoronoiConnectivity(PymatgenTest): +class TestVoronoiConnectivity(MatSciTest): def test_connectivity_array(self): vc = VoronoiConnectivity(self.get_structure("LiFePO4")) ca = vc.connectivity_array @@ -76,7 +76,7 @@ def test_connectivity_array(self): assert_allclose(site.frac_coords, expected) -class TestMiscFunction(PymatgenTest): +class TestMiscFunction(MatSciTest): def test_average_coordination_number(self): xdatcar = Xdatcar(f"{VASP_OUT_DIR}/XDATCAR.MD") coordination_numbers = average_coordination_number(xdatcar.structures, freq=1) diff --git a/tests/analysis/test_structure_matcher.py b/tests/analysis/test_structure_matcher.py index 5106f19a527..bf6f9f00500 100644 --- a/tests/analysis/test_structure_matcher.py +++ b/tests/analysis/test_structure_matcher.py @@ -22,7 +22,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/analysis/structure_matcher" -class TestStructureMatcher(PymatgenTest): +class TestStructureMatcher(MatSciTest): def setup_method(self): with open(f"{TEST_FILES_DIR}/entries/TiO2_entries.json") as file: entries = json.load(file, cls=MontyDecoder) diff --git a/tests/analysis/test_surface_analysis.py b/tests/analysis/test_surface_analysis.py index 2f95ad7edbb..18274d6ded3 100644 --- a/tests/analysis/test_surface_analysis.py +++ b/tests/analysis/test_surface_analysis.py @@ -22,7 +22,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/surfaces" -class TestSlabEntry(PymatgenTest): +class TestSlabEntry(MatSciTest): def setup_method(self): with open(f"{TEST_DIR}/ucell_entries.txt") as file: ucell_entries = json.loads(file.read()) @@ -118,7 +118,7 @@ def test_cleaned_up_slab(self): assert slab_clean.composition.reduced_composition == clean.composition.reduced_composition -class TestSurfaceEnergyPlotter(PymatgenTest): +class TestSurfaceEnergyPlotter(MatSciTest): def setup_method(self): entry_dict = get_entry_dict(f"{TEST_DIR}/Cu_entries.txt") self.Cu_entry_dict = entry_dict @@ -292,7 +292,7 @@ def test_surface_chempot_range_map(self): analyzer.chempot_vs_gamma_facet(hkl) -class TestWorkFunctionAnalyzer(PymatgenTest): +class TestWorkFunctionAnalyzer(MatSciTest): def setup_method(self): self.kwargs = { "poscar_filename": f"{TEST_DIR}/CONTCAR.relax1.gz", @@ -309,7 +309,7 @@ def test_is_converged(self): assert self.wf_analyzer.is_converged() -class TestNanoscaleStability(PymatgenTest): +class TestNanoscaleStability(MatSciTest): def setup_method(self): # Load all entries La_hcp_entry_dict = get_entry_dict(f"{TEST_DIR}/La_hcp_entries.txt") diff --git a/tests/analysis/test_transition_state.py b/tests/analysis/test_transition_state.py index 96841bc482a..78b22aeb305 100644 --- a/tests/analysis/test_transition_state.py +++ b/tests/analysis/test_transition_state.py @@ -23,7 +23,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/io/vasp/fixtures/neb_analysis" -class TestNEBAnalysis(PymatgenTest): +class TestNEBAnalysis(MatSciTest): def test_run(self): neb_analysis1 = NEBAnalysis.from_dir(f"{TEST_DIR}/neb1/neb") neb_analysis1_from_dict = NEBAnalysis.from_dict(neb_analysis1.as_dict()) diff --git a/tests/analysis/test_wulff.py b/tests/analysis/test_wulff.py index 8ecba2e2e41..1a8eeb0284d 100644 --- a/tests/analysis/test_wulff.py +++ b/tests/analysis/test_wulff.py @@ -21,7 +21,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/analysis/wulff" -class TestWulffShape(PymatgenTest): +class TestWulffShape(MatSciTest): def setup_method(self): with open(f"{TEST_DIR}/surface_samples.json") as data_file: surface_properties = json.load(data_file) diff --git a/tests/analysis/test_xps.py b/tests/analysis/test_xps.py index 45b250e3100..a4358f7ad98 100644 --- a/tests/analysis/test_xps.py +++ b/tests/analysis/test_xps.py @@ -5,7 +5,7 @@ from pymatgen.util.testing import VASP_OUT_DIR, PymatgenTest -class TestXPS(PymatgenTest): +class TestXPS(MatSciTest): def test_from_dos(self): vasp_run = Vasprun(f"{VASP_OUT_DIR}/vasprun.LiF.xml.gz") dos = vasp_run.complete_dos diff --git a/tests/analysis/topological/test_spillage.py b/tests/analysis/topological/test_spillage.py index 39224cdfc52..d605e8c2c63 100644 --- a/tests/analysis/topological/test_spillage.py +++ b/tests/analysis/topological/test_spillage.py @@ -8,7 +8,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/analysis/topological" -class TestSolar(PymatgenTest): +class TestSolar(MatSciTest): def test_spillage_from_vasprun(self): wf_noso = f"{TEST_DIR}/WAVECAR-NonSOC" wf_so = f"{TEST_DIR}/WAVECAR-SOC" diff --git a/tests/analysis/xas/test_spectrum.py b/tests/analysis/xas/test_spectrum.py index 54dd93760a7..16a06965e39 100644 --- a/tests/analysis/xas/test_spectrum.py +++ b/tests/analysis/xas/test_spectrum.py @@ -28,7 +28,7 @@ site2_xanes_dict = json.load(file, cls=MontyDecoder) -class TestXAS(PymatgenTest): +class TestXAS(MatSciTest): def setup_method(self): self.k_xanes = XAS.from_dict(k_xanes_dict) self.k_exafs = XAS.from_dict(k_exafs_dict) diff --git a/tests/apps/battery/test_analyzer.py b/tests/apps/battery/test_analyzer.py index 52e59c5680d..d2ee3c75610 100644 --- a/tests/apps/battery/test_analyzer.py +++ b/tests/apps/battery/test_analyzer.py @@ -8,7 +8,7 @@ from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest -class TestBatteryAnalyzer(PymatgenTest): +class TestBatteryAnalyzer(MatSciTest): def load_from_cif(self, filename, oxidations, working_ion="Li"): struct = Structure.from_file(f"{TEST_FILES_DIR}/cif/{filename}") struct.add_oxidation_state_by_element(oxidations) diff --git a/tests/command_line/test_bader_caller.py b/tests/command_line/test_bader_caller.py index 6b63ce9aa9a..019b71af9cd 100644 --- a/tests/command_line/test_bader_caller.py +++ b/tests/command_line/test_bader_caller.py @@ -16,7 +16,7 @@ @pytest.mark.skipif(not which("bader"), reason="bader executable not present") -class TestBaderAnalysis(PymatgenTest): +class TestBaderAnalysis(MatSciTest): def setup_method(self): warnings.catch_warnings() diff --git a/tests/command_line/test_enumlib_caller.py b/tests/command_line/test_enumlib_caller.py index aa3cebff4a3..9717e176e48 100644 --- a/tests/command_line/test_enumlib_caller.py +++ b/tests/command_line/test_enumlib_caller.py @@ -18,7 +18,7 @@ @pytest.mark.skipif(not (ENUM_CMD and MAKESTR_CMD), reason="enumlib not present.") -class TestEnumlibAdaptor(PymatgenTest): +class TestEnumlibAdaptor(MatSciTest): def test_init(self): struct = self.get_structure("LiFePO4") sub_trans = SubstitutionTransformation({"Li": {"Li": 0.5}}) diff --git a/tests/command_line/test_mcsqs_caller.py b/tests/command_line/test_mcsqs_caller.py index aa749e1bab8..f32aba85833 100644 --- a/tests/command_line/test_mcsqs_caller.py +++ b/tests/command_line/test_mcsqs_caller.py @@ -18,7 +18,7 @@ @pytest.mark.skipif(not (which("mcsqs") and which("str2cif")), reason="mcsqs executable not present") -class TestMcsqsCaller(PymatgenTest): +class TestMcsqsCaller(MatSciTest): def setup_method(self): self.pzt_structs = loadfn(f"{TEST_DIR}/pzt-structs.json") self.pzt_structs2 = loadfn(f"{TEST_DIR}/pzt-structs-2.json") diff --git a/tests/command_line/test_vampire_caller.py b/tests/command_line/test_vampire_caller.py index 439c14344c4..30cf129343a 100644 --- a/tests/command_line/test_vampire_caller.py +++ b/tests/command_line/test_vampire_caller.py @@ -14,7 +14,7 @@ @pytest.mark.skipif(not which("vampire-serial"), reason="vampire executable not present") -class TestVampireCaller(PymatgenTest): +class TestVampireCaller(MatSciTest): @classmethod def setup_class(cls): cls.Mn3Al = pd.read_json(f"{TEST_DIR}/Mn3Al.json") diff --git a/tests/core/test_composition.py b/tests/core/test_composition.py index 52d38e0079c..b0a5e3bfe75 100644 --- a/tests/core/test_composition.py +++ b/tests/core/test_composition.py @@ -16,7 +16,7 @@ from pymatgen.util.testing import PymatgenTest -class TestComposition(PymatgenTest): +class TestComposition(MatSciTest): def setup_method(self): self.comps = [ Composition("Li3Fe2(PO4)3"), diff --git a/tests/core/test_interface.py b/tests/core/test_interface.py index ccaaa59dcf6..d9b7ace45b2 100644 --- a/tests/core/test_interface.py +++ b/tests/core/test_interface.py @@ -13,7 +13,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/core/grain_boundary" -class TestGrainBoundary(PymatgenTest): +class TestGrainBoundary(MatSciTest): def setup_method(self): self.Cu_conv = Structure.from_file(f"{TEST_DIR}/Cu_mp-30_conventional_standard.cif") GB_Cu_conv = GrainBoundaryGenerator(self.Cu_conv) @@ -104,7 +104,7 @@ def test_as_dict_and_from_dict(self): assert_allclose(Cu_GB2_new.lattice.matrix, self.Cu_GB2.lattice.matrix) -class TestGrainBoundaryGenerator(PymatgenTest): +class TestGrainBoundaryGenerator(MatSciTest): @classmethod def setup_class(cls): cls.Cu_prim = Structure.from_file(f"{TEST_DIR}/Cu_mp-30_primitive.cif") @@ -331,7 +331,7 @@ def test_get_rotation_angle_from_sigma(self): assert_allclose(close_angle, angle) -class TestInterface(PymatgenTest): +class TestInterface(MatSciTest): def setup_method(self): self.interface: Interface = self.get_structure("Si_SiO2_Interface") diff --git a/tests/core/test_lattice.py b/tests/core/test_lattice.py index 1bbe8f4b865..622da5c9b24 100644 --- a/tests/core/test_lattice.py +++ b/tests/core/test_lattice.py @@ -12,7 +12,7 @@ from pymatgen.util.testing import PymatgenTest -class TestLattice(PymatgenTest): +class TestLattice(MatSciTest): def setup_method(self): self.lattice = Lattice.cubic(10.0) self.cubic = self.lattice diff --git a/tests/core/test_libxcfunc.py b/tests/core/test_libxcfunc.py index 435b71c389e..7fb82780466 100644 --- a/tests/core/test_libxcfunc.py +++ b/tests/core/test_libxcfunc.py @@ -4,7 +4,7 @@ from pymatgen.util.testing import PymatgenTest -class TestLibxcFunc(PymatgenTest): +class TestLibxcFunc(MatSciTest): def test_libxcfunc_api(self): """Testing libxcfunc_api.""" # LDA correlation: Hedin & Lundqvist diff --git a/tests/core/test_molecular_orbitals.py b/tests/core/test_molecular_orbitals.py index 4476c856d17..4943a17ec7a 100644 --- a/tests/core/test_molecular_orbitals.py +++ b/tests/core/test_molecular_orbitals.py @@ -8,7 +8,7 @@ test_case = MolecularOrbitals("NaCl") -class TestMolecularOrbital(PymatgenTest): +class TestMolecularOrbital(MatSciTest): def test_max_electronegativity(self): test_elec_neg = 2.23 assert test_elec_neg == test_case.max_electronegativity() diff --git a/tests/core/test_operations.py b/tests/core/test_operations.py index 63efb6317c3..3376993f310 100644 --- a/tests/core/test_operations.py +++ b/tests/core/test_operations.py @@ -8,7 +8,7 @@ from pymatgen.util.testing import PymatgenTest -class TestSymmOp(PymatgenTest): +class TestSymmOp(MatSciTest): def setup_method(self): self.op = SymmOp.from_axis_angle_and_translation([0, 0, 1], 30, translation_vec=[0, 0, 1]) @@ -236,7 +236,7 @@ def test_xyz(self): assert_allclose(symm_op.translation_vector, [0.5, 0.25, 0.75]) -class TestMagSymmOp(PymatgenTest): +class TestMagSymmOp(MatSciTest): def test_xyzt_string(self): xyzt_strings = ["x, y, z, +1", "x, y, z, -1", "-y+1/2, x+1/2, x+1/2, +1"] diff --git a/tests/core/test_periodic_table.py b/tests/core/test_periodic_table.py index 1a1c2fa68fe..1bb2e76473b 100644 --- a/tests/core/test_periodic_table.py +++ b/tests/core/test_periodic_table.py @@ -17,7 +17,7 @@ from pymatgen.util.testing import PymatgenTest -class TestElement(PymatgenTest): +class TestElement(MatSciTest): def test_init(self): assert Element("Fe").symbol == "Fe" @@ -392,7 +392,7 @@ def test_isotope(self): ] -class TestSpecies(PymatgenTest): +class TestSpecies(MatSciTest): def setup_method(self): self.specie1 = Species.from_str("Fe2+") self.specie2 = Species("Fe", 3) diff --git a/tests/core/test_sites.py b/tests/core/test_sites.py index c8d53ca6f19..b1d3cfa0675 100644 --- a/tests/core/test_sites.py +++ b/tests/core/test_sites.py @@ -12,7 +12,7 @@ from pymatgen.util.testing import PymatgenTest -class TestSite(PymatgenTest): +class TestSite(MatSciTest): def setup_method(self): self.ordered_site = Site("Fe", [0.25, 0.35, 0.45]) self.disordered_site = Site({"Fe": 0.5, "Mn": 0.5}, [0.25, 0.35, 0.45]) @@ -79,7 +79,7 @@ def test_setters(self): self.disordered_site.species = {"Cu": 0.5, "Gd": 0.6} -class TestPeriodicSite(PymatgenTest): +class TestPeriodicSite(MatSciTest): def setup_method(self): self.lattice = Lattice.cubic(10.0) self.si = Element("Si") diff --git a/tests/core/test_spectrum.py b/tests/core/test_spectrum.py index 4d317e016ad..5c2cd5780e1 100644 --- a/tests/core/test_spectrum.py +++ b/tests/core/test_spectrum.py @@ -9,7 +9,7 @@ from pymatgen.util.testing import PymatgenTest -class TestSpectrum(PymatgenTest): +class TestSpectrum(MatSciTest): def setup_method(self): rng = np.random.default_rng() self.spec1 = Spectrum(np.arange(0, 10, 0.1), rng.standard_normal(100)) diff --git a/tests/core/test_structure.py b/tests/core/test_structure.py index 365cdfbab6d..028cc36b234 100644 --- a/tests/core/test_structure.py +++ b/tests/core/test_structure.py @@ -44,7 +44,7 @@ mcsqs_cmd = which("mcsqs") -class TestNeighbor(PymatgenTest): +class TestNeighbor(MatSciTest): def test_msonable(self): struct = PymatgenTest.get_structure("Li2O") nn = struct.get_neighbors(struct[0], r=3) @@ -63,7 +63,7 @@ def test_neighbor_labels(self): assert p_neighbor.label == label if label is not None else "C" -class TestIStructure(PymatgenTest): +class TestIStructure(MatSciTest): def setup_method(self): coords = [[0, 0, 0], [0.75, 0.5, 0.75]] self.lattice = Lattice( @@ -965,7 +965,7 @@ def test_sites_setter(self): assert struct.sites == new_sites -class TestStructure(PymatgenTest): +class TestStructure(MatSciTest): def setup_method(self): coords = [[0, 0, 0], [0.75, 0.5, 0.75]] lattice = Lattice( @@ -2032,7 +2032,7 @@ def test_struct_with_isotope(self): assert "Deuterium" not in [el.long_name for el in struct.composition.elements] -class TestIMolecule(PymatgenTest): +class TestIMolecule(MatSciTest): def setup_method(self): coords = [ [0, 0, 0], @@ -2327,7 +2327,7 @@ def test_to_file_alias(self): assert os.path.isfile(out_path) -class TestMolecule(PymatgenTest): +class TestMolecule(MatSciTest): def setup_method(self): coords = [ [0, 0, 0], diff --git a/tests/core/test_surface.py b/tests/core/test_surface.py index e57f7a3edb6..ceff64a3457 100644 --- a/tests/core/test_surface.py +++ b/tests/core/test_surface.py @@ -29,7 +29,7 @@ PMG_CORE_DIR = os.path.dirname(pymatgen.core.__file__) -class TestSlab(PymatgenTest): +class TestSlab(MatSciTest): def setup_method(self): zno1 = Structure.from_file(f"{TEST_FILES_DIR}/surfaces/ZnO-wz.cif", primitive=False) zno55 = SlabGenerator(zno1, [1, 0, 0], 5, 5, lll_reduce=False, center_slab=False).get_slab() @@ -346,7 +346,7 @@ def test_as_dict(self): assert slab == Slab.from_dict(d) -class TestSlabGenerator(PymatgenTest): +class TestSlabGenerator(MatSciTest): def setup_method(self): lattice = Lattice.cubic(3.010) frac_coords = [ @@ -634,7 +634,7 @@ def test_bonds_broken(self): assert slabs[1].energy, 6.0 -class ReconstructionGeneratorTests(PymatgenTest): +class ReconstructionGeneratorTests(MatSciTest): def setup_method(self): lattice = Lattice.cubic(3.51) species = ["Ni"] @@ -723,7 +723,7 @@ def test_previous_reconstructions(self): assert any(len(match.group_structures([struct, slab])) == 1 for slab in slabs) -class TestMillerIndexFinder(PymatgenTest): +class TestMillerIndexFinder(MatSciTest): def setup_method(self): self.cscl = Structure.from_spacegroup("Pm-3m", Lattice.cubic(4.2), ["Cs", "Cl"], [[0, 0, 0], [0.5, 0.5, 0.5]]) self.Fe = Structure.from_spacegroup("Im-3m", Lattice.cubic(2.82), ["Fe"], [[0, 0, 0]]) diff --git a/tests/core/test_tensors.py b/tests/core/test_tensors.py index 94c3a24d395..972e8b3f207 100644 --- a/tests/core/test_tensors.py +++ b/tests/core/test_tensors.py @@ -14,7 +14,7 @@ from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest -class TestTensor(PymatgenTest): +class TestTensor(MatSciTest): def setup_method(self): rng = np.random.default_rng() @@ -379,7 +379,7 @@ def test_round(self): assert isinstance(rounded, Tensor) -class TestTensorCollection(PymatgenTest): +class TestTensorCollection(MatSciTest): def setup_method(self): self.seq_tc = list(np.arange(4 * 3**3).reshape((4, 3, 3, 3))) self.seq_tc = TensorCollection(self.seq_tc) @@ -472,7 +472,7 @@ def test_serialization(self): assert_allclose(t, t_new) -class TestSquareTensor(PymatgenTest): +class TestSquareTensor(MatSciTest): def setup_method(self): self.rand_sqtensor = SquareTensor(np.random.default_rng().standard_normal((3, 3))) self.symm_sqtensor = SquareTensor([[0.1, 0.3, 0.4], [0.3, 0.5, 0.2], [0.4, 0.2, 0.6]]) diff --git a/tests/core/test_trajectory.py b/tests/core/test_trajectory.py index 9259b5f1b44..1ff941ecbf9 100644 --- a/tests/core/test_trajectory.py +++ b/tests/core/test_trajectory.py @@ -17,7 +17,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/core/trajectory" -class TestTrajectory(PymatgenTest): +class TestTrajectory(MatSciTest): def setup_method(self): xdatcar = Xdatcar(f"{VASP_OUT_DIR}/XDATCAR_traj") self.traj = Trajectory.from_file(f"{VASP_OUT_DIR}/XDATCAR_traj") diff --git a/tests/core/test_units.py b/tests/core/test_units.py index 88e06d92517..3e420bdad8f 100644 --- a/tests/core/test_units.py +++ b/tests/core/test_units.py @@ -37,7 +37,7 @@ def test_unit_conversions(): assert amu_to_kg == approx(1.66053906660e-27) -class TestUnit(PymatgenTest): +class TestUnit(MatSciTest): def test_init(self): u1 = Unit((("m", 1), ("s", -1))) assert str(u1) == "m s^-1" @@ -53,7 +53,7 @@ def test_init(self): assert str(newton * Unit("m")) == "N m" -class TestFloatWithUnit(PymatgenTest): +class TestFloatWithUnit(MatSciTest): def test_energy(self): a = Energy(1.1, "eV") b = a.to("Ha") @@ -185,7 +185,7 @@ def test_neg(self): assert FloatWithUnit(-5, "MPa") == -x -class TestArrayWithUnit(PymatgenTest): +class TestArrayWithUnit(MatSciTest): def test_energy(self): """Similar to TestFloatWithUnit.test_energy. Check whether EnergyArray and FloatWithUnit have same behavior. @@ -293,7 +293,7 @@ def test_as_base_units(self): assert_array_equal(ArrayWithUnit([5000000, 10000000], "Pa"), pressure_arr.as_base_units) -class TestDataPersistence(PymatgenTest): +class TestDataPersistence(MatSciTest): def test_pickle(self): """Test whether FloatWithUnit and ArrayWithUnit support pickle.""" for cls in [FloatWithUnit, ArrayWithUnit]: diff --git a/tests/core/test_xcfunc.py b/tests/core/test_xcfunc.py index 793fb9f7cad..fb95376d4b9 100644 --- a/tests/core/test_xcfunc.py +++ b/tests/core/test_xcfunc.py @@ -6,7 +6,7 @@ from pymatgen.util.testing import PymatgenTest -class TestLibxcFunc(PymatgenTest): +class TestLibxcFunc(MatSciTest): def setup_method(self) -> None: self.ixc_11 = XcFunc.from_abinit_ixc(11) diff --git a/tests/electronic_structure/test_bandstructure.py b/tests/electronic_structure/test_bandstructure.py index a1e88e8ab0e..5547a61dc40 100644 --- a/tests/electronic_structure/test_bandstructure.py +++ b/tests/electronic_structure/test_bandstructure.py @@ -67,7 +67,7 @@ def test_from_dict(self): assert kpoint.label == "X" -class TestBandStructureSymmLine(PymatgenTest): +class TestBandStructureSymmLine(MatSciTest): def setup_method(self): self.bs: BandStructureSymmLine = loadfn(f"{TEST_DIR}/Cu2O_361_bandstructure.json") self.bs2: BandStructureSymmLine = loadfn(f"{TEST_DIR}/CaO_2605_bandstructure.json") @@ -257,7 +257,7 @@ def test_apply_scissor_spin_polarized(self): assert bs_scissored.efermi != approx(orig_efermi) -class TestReconstructBandStructure(PymatgenTest): +class TestReconstructBandStructure(MatSciTest): def setup_method(self): self.bs_cu: BandStructureSymmLine = loadfn(f"{TEST_DIR}/Cu_30_bandstructure.json") self.bs_cu2: BandStructureSymmLine = loadfn(f"{TEST_DIR}/Cu_30_bandstructure.json") @@ -276,7 +276,7 @@ def test_vasprun_bs(self): bs.get_projection_on_elements() -class TestLobsterBandStructureSymmLine(PymatgenTest): +class TestLobsterBandStructureSymmLine(MatSciTest): def setup_method(self): with open( f"{TEST_FILES_DIR}/electronic_structure/cohp/Fatband_SiO2/Test_p/lobster_band_structure_spin.json", diff --git a/tests/electronic_structure/test_cohp.py b/tests/electronic_structure/test_cohp.py index 78f09623d09..2f4bfdfb73b 100644 --- a/tests/electronic_structure/test_cohp.py +++ b/tests/electronic_structure/test_cohp.py @@ -796,7 +796,7 @@ def test_extremum_icohpvalue(self): assert self.icoopcollection_Fe.extremum_icohpvalue(summed_spin_channels=False, spin=Spin.down) == -0.05756 -class TestCompleteCohp(PymatgenTest): +class TestCompleteCohp(MatSciTest): def setup_method(self): filepath = f"{TEST_DIR}/complete_cohp_lobster.json" with open(filepath) as file: diff --git a/tests/electronic_structure/test_dos.py b/tests/electronic_structure/test_dos.py index fa0f5b1ff91..3474d31f2be 100644 --- a/tests/electronic_structure/test_dos.py +++ b/tests/electronic_structure/test_dos.py @@ -322,7 +322,7 @@ def test_dos_fp_exceptions(self): self.dos.get_dos_fp_similarity(dos_fp, dos_fp2, col=1, metric=metric, normalize=False) -class TestDOS(PymatgenTest): +class TestDOS(MatSciTest): def setup_method(self): with open(f"{TEST_DIR}/complete_dos.json") as file: dct = json.load(file) diff --git a/tests/electronic_structure/test_plotter.py b/tests/electronic_structure/test_plotter.py index 813dfa4a556..5ddfe2405e9 100644 --- a/tests/electronic_structure/test_plotter.py +++ b/tests/electronic_structure/test_plotter.py @@ -36,7 +36,7 @@ rc("text", usetex=False) # Disabling latex is needed for this test to work. -class TestDosPlotter(PymatgenTest): +class TestDosPlotter(MatSciTest): def setup_method(self): with open(f"{BAND_TEST_DIR}/../dos/complete_dos.json") as file: self.dos = CompleteDos.from_dict(json.load(file)) @@ -90,7 +90,7 @@ def get_plot_attributes(ax: plt.Axes): } -class TestBSPlotter(PymatgenTest): +class TestBSPlotter(MatSciTest): def setup_method(self): with open(f"{BAND_TEST_DIR}/CaO_2605_bandstructure.json") as file: dct = json.loads(file.read()) @@ -443,7 +443,7 @@ def test_plot_zt_temp(self): plt.close() -class TestCohpPlotter(PymatgenTest): +class TestCohpPlotter(MatSciTest): def setup_method(self): path = f"{TEST_FILES_DIR}/electronic_structure/cohp/complete_cohp_lobster.json" with open(path) as file: diff --git a/tests/entries/test_entry_tools.py b/tests/entries/test_entry_tools.py index a3c559239ed..26e673af718 100644 --- a/tests/entries/test_entry_tools.py +++ b/tests/entries/test_entry_tools.py @@ -14,7 +14,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/entries" -class TestFunc(PymatgenTest): +class TestFunc(MatSciTest): def test_group_entries_by_structure(self): entries = loadfn(f"{TEST_DIR}/TiO2_entries.json") groups = group_entries_by_structure(entries) @@ -49,7 +49,7 @@ def test_group_entries_by_composition(self): assert group == sorted(group, key=lambda e: e.energy_per_atom) -class TestEntrySet(PymatgenTest): +class TestEntrySet(MatSciTest): def setup_method(self): entries = loadfn(f"{TEST_DIR}/Li-Fe-P-O_entries.json") self.entry_set = EntrySet(entries) diff --git a/tests/ext/test_matproj.py b/tests/ext/test_matproj.py index 7f4093d8d84..65c0fd64444 100644 --- a/tests/ext/test_matproj.py +++ b/tests/ext/test_matproj.py @@ -48,7 +48,7 @@ not 10 < len(PMG_MAPI_KEY) <= 20, reason="Legacy PMG_MAPI_KEY environment variable not set.", ) -class TestMPResterOld(PymatgenTest): +class TestMPResterOld(MatSciTest): def setup_method(self): self.rester = _MPResterLegacy() @@ -528,7 +528,7 @@ def test_api_key_is_none(self): not len(PMG_MAPI_KEY) > 20, reason="PMG_MAPI_KEY environment variable not set.", ) -class TestMPResterNewBasic(PymatgenTest): +class TestMPResterNewBasic(MatSciTest): def setup_method(self): self.rester = _MPResterBasic() diff --git a/tests/ext/test_optimade.py b/tests/ext/test_optimade.py index e2710ddeaff..01882b19cfc 100644 --- a/tests/ext/test_optimade.py +++ b/tests/ext/test_optimade.py @@ -36,7 +36,7 @@ mc2d_down = True -class TestOptimade(PymatgenTest): +class TestOptimade(MatSciTest): @pytest.mark.skipif(mp_website_down, reason="MP OPTIMADE is down.") def test_get_structures_mp(self): with OptimadeRester("mp") as optimade: diff --git a/tests/io/abinit/test_abiobjects.py b/tests/io/abinit/test_abiobjects.py index ad38c49dafe..f6afb2de78a 100644 --- a/tests/io/abinit/test_abiobjects.py +++ b/tests/io/abinit/test_abiobjects.py @@ -22,7 +22,7 @@ from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest -class TestLatticeFromAbivars(PymatgenTest): +class TestLatticeFromAbivars(MatSciTest): def test_rprim_acell(self): l1 = lattice_from_abivars(acell=3 * [10], rprim=np.eye(3)) assert l1.volume == approx(bohr_to_ang**3 * 1000) @@ -108,7 +108,7 @@ def test_znucl_typat(self): structure_to_abivars(gan, enforce_znucl=enforce_znucl, enforce_typat=None) -class TestSpinMode(PymatgenTest): +class TestSpinMode(MatSciTest): def test_base(self): polarized = SpinMode.as_spinmode("polarized") other_polarized = SpinMode.as_spinmode("polarized") @@ -128,7 +128,7 @@ def test_base(self): self.assert_msonable(unpolarized) -class TestSmearing(PymatgenTest): +class TestSmearing(MatSciTest): def test_base(self): fd1ev = Smearing.as_smearing("fermi_dirac:1 eV") fd1ev.to_abivars() @@ -156,7 +156,7 @@ def test_base(self): self.assert_msonable(fd1ev) -class TestElectronsAlgorithm(PymatgenTest): +class TestElectronsAlgorithm(MatSciTest): def test_base(self): algo = ElectronsAlgorithm(nstep=70) _ = algo.to_abivars() @@ -168,7 +168,7 @@ def test_base(self): self.assert_msonable(algo) -class TestElectrons(PymatgenTest): +class TestElectrons(MatSciTest): def test_base(self): default_electrons = Electrons() assert default_electrons.nsppol == 2 @@ -195,7 +195,7 @@ def test_base(self): self.assert_msonable(custom_electrons) -class TestKSampling(PymatgenTest): +class TestKSampling(MatSciTest): def test_base(self): monkhorst = KSampling.monkhorst((3, 3, 3), (0.5, 0.5, 0.5), 0, use_symmetries=False, use_time_reversal=False) gamma_centered = KSampling.gamma_centered((3, 3, 3), use_symmetries=False, use_time_reversal=False) @@ -207,7 +207,7 @@ def test_base(self): self.assert_msonable(gamma_centered) -class TestRelaxation(PymatgenTest): +class TestRelaxation(MatSciTest): def test_base(self): atoms_and_cell = RelaxationMethod.atoms_and_cell() atoms_only = RelaxationMethod.atoms_only() @@ -227,7 +227,7 @@ def test_base(self): self.assert_msonable(atoms_only) -class TestPPModel(PymatgenTest): +class TestPPModel(MatSciTest): def test_base(self): godby = PPModel.as_ppmodel("godby:12 eV") godby.to_abivars() diff --git a/tests/io/abinit/test_inputs.py b/tests/io/abinit/test_inputs.py index 4bc0229b0f3..e16ac9abb66 100644 --- a/tests/io/abinit/test_inputs.py +++ b/tests/io/abinit/test_inputs.py @@ -33,7 +33,7 @@ def abiref_files(*filenames): return [f"{TEST_DIR}/{file}" for file in filenames] -class TestAbinitInput(PymatgenTest): +class TestAbinitInput(MatSciTest): """Unit tests for BasicAbinitInput.""" def test_api(self): @@ -168,7 +168,7 @@ def test_helper_functions(self): assert len(inp["kptbounds"]) == 12 -class TestMultiDataset(PymatgenTest): +class TestMultiDataset(MatSciTest): """Unit tests for BasicMultiDataset.""" def test_api(self): @@ -251,7 +251,7 @@ def test_api(self): self.serialize_with_pickle(multi, test_eq=False) -class TestShiftMode(PymatgenTest): +class TestShiftMode(MatSciTest): def test_shiftmode(self): gamma = ShiftMode.GammaCentered assert ShiftMode.from_object("G") == gamma @@ -260,7 +260,7 @@ def test_shiftmode(self): ShiftMode.from_object({}) -class TestFactory(PymatgenTest): +class TestFactory(MatSciTest): def setup_method(self): # Si ebands self.si_structure = Structure.from_file(abiref_file("si.cif")) diff --git a/tests/io/abinit/test_netcdf.py b/tests/io/abinit/test_netcdf.py index 16c0babe320..c0d9cff9a53 100644 --- a/tests/io/abinit/test_netcdf.py +++ b/tests/io/abinit/test_netcdf.py @@ -21,7 +21,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/io/abinit" -class TestEtsfReader(PymatgenTest): +class TestEtsfReader(MatSciTest): def setup_method(self): formulas = ["Si2"] self.GSR_paths = dct = {} @@ -117,7 +117,7 @@ def test_read_fe(self): assert structure.site_properties["magmom"] == ref_magmom_noncollinear -class TestAbinitHeader(PymatgenTest): +class TestAbinitHeader(MatSciTest): def test_api(self): head = AbinitHeader(foo=1, bar=2) assert head.foo == 1 diff --git a/tests/io/abinit/test_pseudos.py b/tests/io/abinit/test_pseudos.py index 518036ce6ed..752518d4d6b 100644 --- a/tests/io/abinit/test_pseudos.py +++ b/tests/io/abinit/test_pseudos.py @@ -14,7 +14,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/io/abinit" -class TestPseudo(PymatgenTest): +class TestPseudo(MatSciTest): def setup_method(self): nc_pseudo_fnames = defaultdict(list) nc_pseudo_fnames["Si"] = [f"{TEST_DIR}/{file}" for file in ("14si.pspnc", "14si.4.hgh", "14-Si.LDA.fhi")] @@ -198,7 +198,7 @@ def test_oncvpsp_pseudo_fr(self): assert pb.supports_soc -class TestPseudoTable(PymatgenTest): +class TestPseudoTable(MatSciTest): def test_methods(self): """Test PseudoTable methods.""" table = PseudoTable([f"{TEST_DIR}/{file}" for file in ("14si.pspnc", "14si.4.hgh", "14-Si.LDA.fhi")]) diff --git a/tests/io/cp2k/test_inputs.py b/tests/io/cp2k/test_inputs.py index d55100773fe..9e4ae2ae50c 100644 --- a/tests/io/cp2k/test_inputs.py +++ b/tests/io/cp2k/test_inputs.py @@ -41,7 +41,7 @@ """ -class TestBasis(PymatgenTest): +class TestBasis(MatSciTest): def test_basis_info(self): # Ensure basis metadata can be read from string basis_info = BasisInfo.from_str("cc-pc-DZVP-MOLOPT-q1-SCAN") @@ -92,7 +92,7 @@ def test_basis(self): mol_opt.info.admm = False -class TestPotential(PymatgenTest): +class TestPotential(MatSciTest): all_hydrogen_str = """ H ALLELECTRON ALL 1 0 0 @@ -144,7 +144,7 @@ def test_potentials(self): assert kw.values[0] == "ALL" -class TestCp2kInput(PymatgenTest): +class TestCp2kInput(MatSciTest): si_struct = Structure( lattice=[ [0, 2.734364, 2.734364], @@ -268,7 +268,7 @@ def test_mongo(self): assert cp2k_input.check("global/subsec2") -class TestDataFile(PymatgenTest): +class TestDataFile(MatSciTest): def test_data_file(self): # make temp file with BASIS_FILE_STR data_file = self.tmp_path / "data-file" diff --git a/tests/io/cp2k/test_sets.py b/tests/io/cp2k/test_sets.py index e2c74bc31a6..3c28e85c953 100644 --- a/tests/io/cp2k/test_sets.py +++ b/tests/io/cp2k/test_sets.py @@ -46,7 +46,7 @@ } -class TestDftSet(PymatgenTest): +class TestDftSet(MatSciTest): def test_dft_set(self) -> None: """Test various DFT set configurations.""" SETTINGS["PMG_CP2K_DATA_DIR"] = CP2K_TEST_DIR diff --git a/tests/io/exciting/test_inputs.py b/tests/io/exciting/test_inputs.py index ccbac253944..89b6fa0cfcf 100644 --- a/tests/io/exciting/test_inputs.py +++ b/tests/io/exciting/test_inputs.py @@ -19,7 +19,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/io/exciting" -class TestExcitingInput(PymatgenTest): +class TestExcitingInput(MatSciTest): def test_fromfile(self): # Test for the import of a structure directly from an exciting # input file diff --git a/tests/io/feff/test_sets.py b/tests/io/feff/test_sets.py index faf3aa85b78..87b5e5896be 100644 --- a/tests/io/feff/test_sets.py +++ b/tests/io/feff/test_sets.py @@ -14,7 +14,7 @@ FEFF_TEST_DIR = f"{TEST_FILES_DIR}/io/feff" -class TestFeffInputSet(PymatgenTest): +class TestFeffInputSet(MatSciTest): @classmethod def setup_class(cls): cls.header_string = """* This FEFF.inp file generated by pymatgen diff --git a/tests/io/lammps/test_data.py b/tests/io/lammps/test_data.py index 53bc5005080..e57303a49eb 100644 --- a/tests/io/lammps/test_data.py +++ b/tests/io/lammps/test_data.py @@ -18,7 +18,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/io/lammps" -class TestLammpsBox(PymatgenTest): +class TestLammpsBox(MatSciTest): @classmethod def setup_class(cls): cls.peptide = LammpsBox( @@ -72,7 +72,7 @@ def test_to_lattice(self): ) -class TestLammpsData(PymatgenTest): +class TestLammpsData(MatSciTest): @classmethod def setup_class(cls): cls.peptide = LammpsData.from_file(filename=f"{TEST_DIR}/data.peptide") @@ -664,7 +664,7 @@ def test_from_bonding(self): assert "Dihedrals" not in topo_etoh2.topologies -class TestForceField(PymatgenTest): +class TestForceField(MatSciTest): @classmethod def setup_class(cls): mass_info = [ diff --git a/tests/io/lammps/test_generators.py b/tests/io/lammps/test_generators.py index 950542da6ff..ea3d91b18b4 100644 --- a/tests/io/lammps/test_generators.py +++ b/tests/io/lammps/test_generators.py @@ -8,7 +8,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/io/lammps" -class TestLammpsMinimization(PymatgenTest): +class TestLammpsMinimization(MatSciTest): @classmethod def setup_class(cls): cls.filename = f"{TEST_DIR}/lgps.in" diff --git a/tests/io/lammps/test_inputs.py b/tests/io/lammps/test_inputs.py index 23e3df888fd..09efce63c81 100644 --- a/tests/io/lammps/test_inputs.py +++ b/tests/io/lammps/test_inputs.py @@ -16,7 +16,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/io/lammps" -class TestLammpsInputFile(PymatgenTest): +class TestLammpsInputFile(MatSciTest): @classmethod def setup_class(cls): cls.filename = f"{TEST_DIR}/lgps.in" @@ -640,7 +640,7 @@ def test_add_comment(self): ] -class TestLammpsRun(PymatgenTest): +class TestLammpsRun(MatSciTest): def test_md(self): struct = Structure.from_spacegroup(225, Lattice.cubic(3.62126), ["Cu"], [[0, 0, 0]]) ld = LammpsData.from_structure(struct, atom_style="atomic") @@ -690,7 +690,7 @@ def test_md(self): assert os.path.isfile(f"{self.tmp_path}/md/md.data") -class TestFunc(PymatgenTest): +class TestFunc(MatSciTest): @pytest.mark.filterwarnings("ignore:write_lammps_inputs is deprecated") def test_write_lammps_inputs(self): # script template @@ -727,7 +727,7 @@ def test_write_lammps_inputs(self): pd.testing.assert_frame_equal(obj_read.atoms, obj.atoms) -class TestLammpsTemplateGen(PymatgenTest): +class TestLammpsTemplateGen(MatSciTest): def test_write_inputs(self): # simple script without data file lis = LammpsTemplateGen().get_input_set( diff --git a/tests/io/lobster/test_inputs.py b/tests/io/lobster/test_inputs.py index 9e7dbe2b97e..a5140a0ed36 100644 --- a/tests/io/lobster/test_inputs.py +++ b/tests/io/lobster/test_inputs.py @@ -19,7 +19,7 @@ __date__ = "Dec 10, 2017" -class TestLobsterin(PymatgenTest): +class TestLobsterin(MatSciTest): def setup_method(self): self.Lobsterin = Lobsterin.from_file(f"{TEST_DIR}/lobsterin.1") self.Lobsterin2 = Lobsterin.from_file(f"{TEST_DIR}/lobsterin.2") @@ -579,7 +579,7 @@ def test_as_from_dict(self): new_lobsterin.to_json() -class TestUtils(PymatgenTest): +class TestUtils(MatSciTest): def test_get_all_possible_basis_combinations(self): # this basis is just for testing (not correct) min_basis = ["Li 1s 2s ", "Na 1s 2s", "Si 1s 2s"] diff --git a/tests/io/lobster/test_outputs.py b/tests/io/lobster/test_outputs.py index 5728aac419d..17fc2ff122e 100644 --- a/tests/io/lobster/test_outputs.py +++ b/tests/io/lobster/test_outputs.py @@ -41,7 +41,7 @@ __date__ = "Dec 10, 2017" -class TestBwdf(PymatgenTest): +class TestBwdf(MatSciTest): def setup_method(self): self.bwdf_coop = Bwdf(filename=f"{TEST_DIR}/BWDF.lobster.AlN.gz") self.bwdf_cohp = Bwdf(filename=f"{TEST_DIR}/BWDFCOHP.lobster.NaCl.gz") @@ -56,7 +56,7 @@ def test_attributes(self): assert self.bwdf_cohp.bwdf[Spin.up][103] == approx(-0.01392, abs=1e-4) -class TestCohpcar(PymatgenTest): +class TestCohpcar(MatSciTest): def setup_method(self): self.cohp_bise = Cohpcar(filename=f"{TEST_DIR}/COHPCAR.lobster.BiSe.gz") self.coop_bise = Cohpcar( @@ -636,7 +636,7 @@ def test_is_spin_polarized(self): assert not self.DOSCAR_nonspin_pol.is_spin_polarized -class TestCharge(PymatgenTest): +class TestCharge(MatSciTest): def setup_method(self): self.charge2 = Charge(filename=f"{TEST_DIR}/CHARGE.lobster.MnO") # gzipped file @@ -715,7 +715,7 @@ def test_msonable(self): assert getattr(charge_from_dict, attr_name) == attr_value -class TestLobsterout(PymatgenTest): +class TestLobsterout(MatSciTest): def setup_method(self): self.lobsterout_normal = Lobsterout(filename=f"{TEST_DIR}/lobsterout.normal") # make sure .gz files are also read correctly @@ -1244,7 +1244,7 @@ def test_msonable(self): Lobsterout(filename=None, invalid="val") -class TestFatband(PymatgenTest): +class TestFatband(MatSciTest): def setup_method(self): self.structure = Vasprun( filename=f"{TEST_DIR}/Fatband_SiO2/Test_p_x/vasprun.xml", @@ -2203,7 +2203,7 @@ def test_ncicobilist(self): ) -class TestWavefunction(PymatgenTest): +class TestWavefunction(MatSciTest): def test_parse_file(self): grid, points, real, imaginary, distance = Wavefunction._parse_file( f"{TEST_DIR}/LCAOWaveFunctionAfterLSO1PlotOfSpin1Kpoint1band1.gz" @@ -2271,7 +2271,7 @@ def test_write_file(self): assert os.path.isfile(density_wavecar_path) -class TestSitePotentials(PymatgenTest): +class TestSitePotentials(MatSciTest): def setup_method(self) -> None: self.sitepotential = SitePotential(filename=f"{TEST_DIR}/SitePotentials.lobster.perovskite") @@ -2322,7 +2322,7 @@ def test_msonable(self): assert getattr(sitepotential_from_dict, attr_name) == attr_value -class TestMadelungEnergies(PymatgenTest): +class TestMadelungEnergies(MatSciTest): def setup_method(self) -> None: self.madelungenergies = MadelungEnergies(filename=f"{TEST_DIR}/MadelungEnergies.lobster.perovskite") @@ -2339,7 +2339,7 @@ def test_msonable(self): assert getattr(madelung_from_dict, attr_name) == attr_value -class TestLobsterMatrices(PymatgenTest): +class TestLobsterMatrices(MatSciTest): def setup_method(self) -> None: self.hamilton_matrices = LobsterMatrices( filename=f"{TEST_DIR}/Na_hamiltonMatrices.lobster.gz", e_fermi=-2.79650354 @@ -2489,7 +2489,7 @@ def test_raises(self): self.hamilton_matrices = LobsterMatrices(filename=f"{TEST_DIR}/hamiltonMatrices.lobster") -class TestPolarization(PymatgenTest): +class TestPolarization(MatSciTest): def setup_method(self) -> None: self.polarization = Polarization(filename=f"{TEST_DIR}/POLARIZATION.lobster.AlN.gz") diff --git a/tests/io/pwmat/test_inputs.py b/tests/io/pwmat/test_inputs.py index 7618e7ecdf6..075446cfb52 100644 --- a/tests/io/pwmat/test_inputs.py +++ b/tests/io/pwmat/test_inputs.py @@ -43,7 +43,7 @@ def test_list_locator(exclusion: str, expected_idx: int): assert aim_idx == expected_idx -class TestACstrExtractor(PymatgenTest): +class TestACstrExtractor(MatSciTest): def test_extract(self): filepath = f"{TEST_DIR}/atom.config" ac_extractor = ACExtractor(file_path=filepath) @@ -60,7 +60,7 @@ def test_extract(self): assert ac_extractor.magmoms[idx] == ac_str_extractor.get_magmoms()[idx] -class TestAtomConfig(PymatgenTest): +class TestAtomConfig(MatSciTest): def test_init(self): filepath = f"{TEST_DIR}/atom.config" structure = Structure.from_file(filepath) @@ -82,7 +82,7 @@ def test_write_file(self): assert_allclose(atom_config.structure.lattice.abc, tmp_atom_config.structure.lattice.abc, 5) -class TestGenKpt(PymatgenTest): +class TestGenKpt(MatSciTest): def test_from_structure(self): pytest.importorskip("seekpath") filepath = f"{TEST_DIR}/atom.config" @@ -107,7 +107,7 @@ def test_write_file(self): assert gen_kpt.get_str() == tmp_gen_kpt_str -class TestHighSymmetryPoint(PymatgenTest): +class TestHighSymmetryPoint(MatSciTest): def test_from_structure(self): pytest.importorskip("seekpath") filepath = f"{TEST_DIR}/atom.config" diff --git a/tests/io/pwmat/test_outputs.py b/tests/io/pwmat/test_outputs.py index b2a97f891fe..d086baea1b8 100644 --- a/tests/io/pwmat/test_outputs.py +++ b/tests/io/pwmat/test_outputs.py @@ -6,7 +6,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/io/pwmat" -class TestMovement(PymatgenTest): +class TestMovement(MatSciTest): def test_init_and_properties(self): filepath = f"{TEST_DIR}/MOVEMENT.lzma" movement = Movement(filepath) @@ -26,14 +26,14 @@ def test_init_and_properties(self): assert movement.ionic_steps[0]["e_tot"] == -357677.2281 -class TestOutFermi(PymatgenTest): +class TestOutFermi(MatSciTest): def test_init_and_properties(self): filepath = f"{TEST_DIR}/OUT.FERMI.lzma" out_fermi = OutFermi(filepath) assert out_fermi.e_fermi == -2.359 -class TestReport(PymatgenTest): +class TestReport(MatSciTest): def test_init_and_properties(self): filepath = f"{TEST_DIR}/REPORT" report = Report(filepath) @@ -46,7 +46,7 @@ def test_init_and_properties(self): assert report.hsps == {} -class TestDosSpin(PymatgenTest): +class TestDosSpin(MatSciTest): def test_init_and_properties(self): filepath = f"{TEST_DIR}/DOS.spinup_projected" dos_spin = DosSpin(filepath) diff --git a/tests/io/qchem/test_inputs.py b/tests/io/qchem/test_inputs.py index fe87a29a095..b9bf1bca998 100644 --- a/tests/io/qchem/test_inputs.py +++ b/tests/io/qchem/test_inputs.py @@ -20,7 +20,7 @@ __credits__ = "Xiaohui Qu" -class TestQCInput(PymatgenTest): +class TestQCInput(MatSciTest): def test_molecule_template(self): species = ["C", "O"] coords = [ diff --git a/tests/io/qchem/test_outputs.py b/tests/io/qchem/test_outputs.py index 22f681f8918..6c837d28fca 100644 --- a/tests/io/qchem/test_outputs.py +++ b/tests/io/qchem/test_outputs.py @@ -260,7 +260,7 @@ } -class TestQCOutput(PymatgenTest): +class TestQCOutput(MatSciTest): @staticmethod def generate_single_job_dict(): """Used to generate test dictionary for single jobs.""" diff --git a/tests/io/qchem/test_sets.py b/tests/io/qchem/test_sets.py index 9a677b02ab8..beb3d9a8230 100644 --- a/tests/io/qchem/test_sets.py +++ b/tests/io/qchem/test_sets.py @@ -26,7 +26,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/io/qchem/new_qchem_files" -class TestQChemDictSet(PymatgenTest): +class TestQChemDictSet(MatSciTest): def test_init(self): test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule test_dict_set = QChemDictSet( @@ -469,7 +469,7 @@ def test_solvation_warnings(self): ) -class TestSinglePointSet(PymatgenTest): +class TestSinglePointSet(MatSciTest): def test_init(self): test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule test_sp_set = SinglePointSet(molecule=test_molecule) @@ -671,7 +671,7 @@ def test_plots_init(self): assert test_sp_set.molecule == test_molecule -class TestOptSet(PymatgenTest): +class TestOptSet(MatSciTest): def test_init(self): test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule test_opt_set = OptSet(molecule=test_molecule) @@ -846,7 +846,7 @@ def test_v5_vs_v6(self): assert v6_opt_set_modified.geom_opt == ref_dict -class TestTransitionStateSet(PymatgenTest): +class TestTransitionStateSet(MatSciTest): def test_init(self): test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule test_ts_set = TransitionStateSet(molecule=test_molecule) @@ -927,7 +927,7 @@ def test_smd_init(self): assert test_ts_set.molecule == test_molecule -class TestForceSet(PymatgenTest): +class TestForceSet(MatSciTest): def test_init(self): test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule test_forceset = ForceSet(molecule=test_molecule) @@ -1004,7 +1004,7 @@ def test_smd_init(self): assert test_forceset.molecule == test_molecule -class TestPESScanSet(PymatgenTest): +class TestPESScanSet(MatSciTest): def test_init(self): test_molecule = QCInput.from_file(f"{TEST_DIR}/pes_scan.qin").molecule @@ -1097,7 +1097,7 @@ def test_smd_init(self): assert test_pes_scan.molecule == test_molecule -class TestFreqSet(PymatgenTest): +class TestFreqSet(MatSciTest): def test_init(self): test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule test_freq_set = FreqSet(molecule=test_molecule) diff --git a/tests/io/qchem/test_utils.py b/tests/io/qchem/test_utils.py index 4ad091b8242..d77db30c9a9 100644 --- a/tests/io/qchem/test_utils.py +++ b/tests/io/qchem/test_utils.py @@ -15,7 +15,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/io/qchem/new_qchem_files" -class TestUtil(PymatgenTest): +class TestUtil(MatSciTest): """test utils.""" def test_lower_and_check_unique(self): diff --git a/tests/io/test_adf.py b/tests/io/test_adf.py index d3b6785320f..477b190b61f 100644 --- a/tests/io/test_adf.py +++ b/tests/io/test_adf.py @@ -242,7 +242,7 @@ def test_serialization(self): } -class TestAdfInput(PymatgenTest): +class TestAdfInput(MatSciTest): def test_main(self): tmp_file = f"{self.tmp_path}/adf.temp" mol = Molecule.from_str(rhb18_xyz, "xyz") diff --git a/tests/io/test_atat.py b/tests/io/test_atat.py index a9562f92511..628cb292c6b 100644 --- a/tests/io/test_atat.py +++ b/tests/io/test_atat.py @@ -10,7 +10,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/io/atat/mcsqs" -class TestAtat(PymatgenTest): +class TestAtat(MatSciTest): def test_mcsqs_import(self): test_str = """1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 diff --git a/tests/io/test_cif.py b/tests/io/test_cif.py index eecb2261e84..a437515bff6 100644 --- a/tests/io/test_cif.py +++ b/tests/io/test_cif.py @@ -20,7 +20,7 @@ MCIF_TEST_DIR = f"{TEST_FILES_DIR}/io/cif/mcif" -class TestCifBlock(PymatgenTest): +class TestCifBlock(MatSciTest): def test_to_str(self): with open(f"{TEST_FILES_DIR}/cif/Graphite.cif") as file: cif_str = file.read() @@ -164,7 +164,7 @@ def test_long_loop(self): assert str(CifBlock(data, loops, "test")) == cif_str -class TestCifIO(PymatgenTest): +class TestCifIO(MatSciTest): def test_cif_parser(self): parser = CifParser(f"{TEST_FILES_DIR}/cif/LiFePO4.cif") for struct in parser.parse_structures(): @@ -999,7 +999,7 @@ def test_cif_writer_site_properties(self): assert "O O23 1 0.95662769 0.25000000 0.29286233 1 -1.0" in cif_str -class TestMagCif(PymatgenTest): +class TestMagCif(MatSciTest): def setup_method(self): self.mcif = CifParser(f"{MCIF_TEST_DIR}/magnetic.example.NiO.mcif") self.mcif_ncl = CifParser(f"{MCIF_TEST_DIR}/magnetic.ncl.example.GdB4.mcif") diff --git a/tests/io/test_core.py b/tests/io/test_core.py index 560bd35848b..7a719bb7a4d 100644 --- a/tests/io/test_core.py +++ b/tests/io/test_core.py @@ -44,7 +44,7 @@ def __str__(self): return f"{self.a}\n{self.b}" -class TestInputFile(PymatgenTest): +class TestInputFile(MatSciTest): def test_file_io(self): with pytest.raises(FileNotFoundError, match="No such file or directory: 'fakepath.cif'"): StructInputFile.from_file("fakepath.cif") @@ -64,7 +64,7 @@ def test_msonable(self): assert sif.structure == temp_sif.structure -class TestInputSet(PymatgenTest): +class TestInputSet(MatSciTest): @classmethod def setup_class(cls): cls.sif1 = StructInputFile.from_file(f"{TEST_FILES_DIR}/cif/Li.cif") diff --git a/tests/io/test_lmto.py b/tests/io/test_lmto.py index 25e75d4daa8..8d1b924f7cf 100644 --- a/tests/io/test_lmto.py +++ b/tests/io/test_lmto.py @@ -23,7 +23,7 @@ MODULE_DIR = os.path.dirname(os.path.abspath(__file__)) -class TestCtrl(PymatgenTest): +class TestCtrl(MatSciTest): def setup_method(self): os.chdir(TEST_DIR) self.ref_bise = LMTOCtrl.from_file(filename="CTRL.BiSe") @@ -47,7 +47,7 @@ def test_read_write(self): assert self.ref_bise.structure.matches(ctrl_file.structure) -class TestCopl(PymatgenTest): +class TestCopl(MatSciTest): def setup_method(self): os.chdir(TEST_DIR) self.copl_bise = LMTOCopl("COPL.BiSe") diff --git a/tests/io/test_packmol.py b/tests/io/test_packmol.py index c6d25953dcd..0b671f9f62d 100644 --- a/tests/io/test_packmol.py +++ b/tests/io/test_packmol.py @@ -48,7 +48,7 @@ water = Molecule(water_atoms, water_coords) -class TestPackmolSet(PymatgenTest): +class TestPackmolSet(MatSciTest): def test_packmol_with_molecule(self): """Test coords input as Molecule.""" pw = PackmolBoxGen().get_input_set( diff --git a/tests/io/test_phonopy.py b/tests/io/test_phonopy.py index a34bb5bb9a2..e84414e72d7 100644 --- a/tests/io/test_phonopy.py +++ b/tests/io/test_phonopy.py @@ -41,7 +41,7 @@ PHONON_DIR = f"{TEST_FILES_DIR}/phonon" -class TestPhonopyParser(PymatgenTest): +class TestPhonopyParser(MatSciTest): def test_get_ph_bs(self): ph_bs = get_ph_bs_symm_line(f"{TEST_DIR}/NaCl_band.yaml", has_nac=True) @@ -97,7 +97,7 @@ def test_get_complete_dos(self): @pytest.mark.skipif(Phonopy is None, reason="Phonopy not present") -class TestStructureConversion(PymatgenTest): +class TestStructureConversion(MatSciTest): def test_structure_conversion(self): struct_pmg = PymatgenTest.get_structure("LiFePO4") # add magmoms to site_properties @@ -125,7 +125,7 @@ def test_structure_conversion(self): @pytest.mark.skipif(Phonopy is None, reason="Phonopy not present") -class TestGetDisplacedStructures(PymatgenTest): +class TestGetDisplacedStructures(MatSciTest): def test_get_displaced_structures(self): pmg_s = Structure.from_file(f"{TEST_DIR}/POSCAR-unitcell", primitive=False) supercell_matrix = np.diag((2, 1, 2)) @@ -245,7 +245,7 @@ def test_gruneisen_parameter(self): @pytest.mark.skipif(Phonopy is None, reason="Phonopy not present") -class TestThermalDisplacementMatrices(PymatgenTest): +class TestThermalDisplacementMatrices(MatSciTest): def test_get_thermal_displacement_matrix(self): list_matrices = get_thermal_displacement_matrices( f"{PHONON_DIR}/thermal_displacement_matrices/thermal_displacement_matrices.yaml", diff --git a/tests/io/test_pwscf.py b/tests/io/test_pwscf.py index 5954e02cfd4..bf4db56552c 100644 --- a/tests/io/test_pwscf.py +++ b/tests/io/test_pwscf.py @@ -11,7 +11,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/io/pwscf" -class TestPWInput(PymatgenTest): +class TestPWInput(MatSciTest): def test_init(self): struct = self.get_structure("Li2O") with pytest.raises(PWInputError, match="Missing O2- in pseudo specification"): @@ -542,7 +542,7 @@ def test_custom_decimal_precision_write_and_read_str(self): assert pw_str.strip() == str(PWInput.from_str(pw_str)).strip() -class TestPWOutput(PymatgenTest): +class TestPWOutput(MatSciTest): def setup_method(self): self.pw_out = PWOutput(f"{TEST_DIR}/Si.pwscf.out") diff --git a/tests/io/test_shengbte.py b/tests/io/test_shengbte.py index 2c733a10a9c..641b82c86bc 100644 --- a/tests/io/test_shengbte.py +++ b/tests/io/test_shengbte.py @@ -10,7 +10,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/io/shengbte" -class TestShengBTE(PymatgenTest): +class TestShengBTE(MatSciTest): def setup_method(self): self.filename = f"{TEST_DIR}/CONTROL-CSLD_Si" self.test_dict = { diff --git a/tests/io/test_template_input.py b/tests/io/test_template_input.py index 3be8ae45374..8dfef0d758d 100644 --- a/tests/io/test_template_input.py +++ b/tests/io/test_template_input.py @@ -10,7 +10,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/io" -class TestTemplateInputGen(PymatgenTest): +class TestTemplateInputGen(MatSciTest): def test_write_inputs(self): input_set = TemplateInputGen().get_input_set( template=f"{TEST_DIR}/template_input_file.txt", diff --git a/tests/io/test_wannier90.py b/tests/io/test_wannier90.py index b72e00acc27..b6e9eec3a46 100644 --- a/tests/io/test_wannier90.py +++ b/tests/io/test_wannier90.py @@ -13,7 +13,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/io/wannier90" -class TestUnk(PymatgenTest): +class TestUnk(MatSciTest): def setup_method(self): rng = np.random.default_rng() self.data_std = rng.random((10, 5, 5, 5)) diff --git a/tests/io/test_xcrysden.py b/tests/io/test_xcrysden.py index d742f9ed4b4..bd217b15fbd 100644 --- a/tests/io/test_xcrysden.py +++ b/tests/io/test_xcrysden.py @@ -7,7 +7,7 @@ from pymatgen.util.testing import PymatgenTest -class TestXSF(PymatgenTest): +class TestXSF(MatSciTest): def setup_method(self): self.coords = [[0, 0, 0], [0.75, 0.5, 0.75]] self.lattice = [ diff --git a/tests/io/vasp/test_inputs.py b/tests/io/vasp/test_inputs.py index 6cc48511378..87dd14e1c83 100644 --- a/tests/io/vasp/test_inputs.py +++ b/tests/io/vasp/test_inputs.py @@ -71,7 +71,7 @@ def _mock_complete_potcar_summary_stats(monkeypatch: pytest.MonkeyPatch) -> None @pytest.mark.filterwarnings( "ignore:POTCAR data with symbol .* is not known to pymatgen:pymatgen.io.vasp.inputs.UnknownPotcarWarning" ) -class TestPoscar(PymatgenTest): +class TestPoscar(MatSciTest): def test_init(self): comp = Structure.from_file(f"{VASP_IN_DIR}/POSCAR").composition assert comp == Composition("Fe4P4O16") @@ -648,7 +648,7 @@ def test_vasp_6_4_2_format(self): assert poscar.structure.formula == "Li4 Fe4 P4 O16" -class TestIncar(PymatgenTest): +class TestIncar(MatSciTest): def setup_method(self): self.incar = Incar.from_file(f"{VASP_IN_DIR}/INCAR") @@ -1536,7 +1536,7 @@ def test_copy(self): @pytest.mark.filterwarnings( "ignore:POTCAR data with symbol .* is not known to pymatgen:pymatgen.io.vasp.inputs.UnknownPotcarWarning" ) -class TestPotcar(PymatgenTest): +class TestPotcar(MatSciTest): def setup_method(self): SETTINGS.setdefault("PMG_VASP_PSP_DIR", str(TEST_FILES_DIR)) self.filepath = f"{FAKE_POTCAR_DIR}/POTCAR.gz" @@ -1615,7 +1615,7 @@ def test_pickle(self): @pytest.mark.filterwarnings( "ignore:POTCAR data with symbol .* is not known to pymatgen:pymatgen.io.vasp.inputs.UnknownPotcarWarning" ) -class TestVaspInput(PymatgenTest): +class TestVaspInput(MatSciTest): def setup_method(self): filepath = f"{VASP_IN_DIR}/INCAR" incar = Incar.from_file(filepath) diff --git a/tests/io/vasp/test_optics.py b/tests/io/vasp/test_optics.py index 3a2caf7a94a..db1db1e9fc2 100644 --- a/tests/io/vasp/test_optics.py +++ b/tests/io/vasp/test_optics.py @@ -16,7 +16,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/io/vasp" -class TestVasprun(PymatgenTest): +class TestVasprun(MatSciTest): def test_optics(self): eps_data_path = f"{TEST_DIR}/fixtures/reproduce_eps" vrun = Vasprun(f"{eps_data_path}/vasprun.xml") diff --git a/tests/io/vasp/test_outputs.py b/tests/io/vasp/test_outputs.py index b14510f1778..d76cb004d21 100644 --- a/tests/io/vasp/test_outputs.py +++ b/tests/io/vasp/test_outputs.py @@ -53,7 +53,7 @@ kpts_opt_vrun_path = f"{TEST_DIR}/fixtures/kpoints_opt/vasprun.xml.gz" -class TestVasprun(PymatgenTest): +class TestVasprun(MatSciTest): def test_vasprun_ml(self): # Test for ML MD simulation # The trajectory data is stored in md_data @@ -832,7 +832,7 @@ def test_parse_potcar_cwd_relative(self): assert vrun.potcar_spec[ipot]["summary_stats"] == potcar[ipot]._summary_stats -class TestOutcar(PymatgenTest): +class TestOutcar(MatSciTest): def test_init(self): outcar = Outcar(f"{VASP_OUT_DIR}/OUTCAR.gz") expected_mag = ( @@ -1423,7 +1423,7 @@ def test_read_table_pattern(self): ) -class TestBSVasprun(PymatgenTest): +class TestBSVasprun(MatSciTest): def test_get_band_structure(self): filepath = f"{VASP_OUT_DIR}/vasprun_Si_bands.xml.gz" vasprun = BSVasprun(filepath, parse_potcar_file=False) @@ -1477,7 +1477,7 @@ def test_kpoints_opt(self): assert {*vrun_dct["output"]} >= {"eigenvalues", "eigenvalues_kpoints_opt"} -class TestOszicar(PymatgenTest): +class TestOszicar(MatSciTest): def test_init(self): fpath = f"{VASP_OUT_DIR}/OSZICAR" oszicar = Oszicar(fpath) @@ -1493,7 +1493,7 @@ def test_static(self): assert set(oszicar.ionic_steps[-1]) == set({"F", "E0", "dE", "mag"}) -class TestLocpot(PymatgenTest): +class TestLocpot(MatSciTest): def test_init(self): filepath = f"{VASP_OUT_DIR}/LOCPOT.gz" locpot = Locpot.from_file(filepath) @@ -1514,7 +1514,7 @@ def test_vasp_6x_style(self): assert {str(ele) for ele in locpot.structure.composition} == {"Mg", "Si"} -class TestChgcar(PymatgenTest): +class TestChgcar(MatSciTest): @classmethod def setup_class(cls): filepath = f"{VASP_OUT_DIR}/CHGCAR.nospin.gz" @@ -1638,7 +1638,7 @@ def test_as_dict_and_from_dict(self): ) -class TestAeccars(PymatgenTest): +class TestAeccars(MatSciTest): # https://github.com/materialsproject/pymatgen/pull/3343 def test_read_write_file(self): aeccar0_test = Chgcar.from_file(f"{TEST_FILES_DIR}/command_line/bader/AECCAR0.gz") @@ -1654,7 +1654,7 @@ def test_read_write_file(self): assert_allclose(aeccar2.data["total"], aeccar2_read.data["total"]) -class TestElfcar(PymatgenTest): +class TestElfcar(MatSciTest): def test_init(self): elfcar = Elfcar.from_file(f"{VASP_OUT_DIR}/ELFCAR.gz") assert approx(np.mean(elfcar.data["total"])) == 0.19076207645194002 @@ -1674,7 +1674,7 @@ def test_interpolation(self): assert len(elfcar.linear_slice([0.0, 0.0, 0.0], [1.0, 1.0, 1.0])) == 100 -class TestProcar(PymatgenTest): +class TestProcar(MatSciTest): def test_init(self): filepath = f"{VASP_OUT_DIR}/PROCAR.simple" procar = Procar(filepath) @@ -1817,7 +1817,7 @@ def test_init(self): # TODO: test get_phonon_frequencies once cross-checked -class TestWavecar(PymatgenTest): +class TestWavecar(MatSciTest): def setup_method(self): latt_mat = np.array(np.eye(3) * 10, dtype=float) # lattice vectors self.vol = np.dot(latt_mat[0, :], np.cross(latt_mat[1, :], latt_mat[2, :])) # unit cell volume @@ -2095,7 +2095,7 @@ def test_write_unks(self): assert unk == unk_ncl -class TestEigenval(PymatgenTest): +class TestEigenval(MatSciTest): def test_init(self): eig = Eigenval(f"{VASP_OUT_DIR}/EIGENVAL.gz") assert eig.ispin == 1 @@ -2135,7 +2135,7 @@ def test_eigenvalue_band_properties_separate_spins(self): assert props[3][1] -class TestWaveder(PymatgenTest): +class TestWaveder(MatSciTest): def setup_method(self): wder = Waveder.from_binary(f"{VASP_OUT_DIR}/WAVEDER", "float64") assert wder.nbands == 36 @@ -2168,7 +2168,7 @@ def _check(wder): _check(wderf) -class TestWSWQ(PymatgenTest): +class TestWSWQ(MatSciTest): def setup_method(self): self.wswq = WSWQ.from_file(f"{VASP_OUT_DIR}/WSWQ.gz") diff --git a/tests/io/vasp/test_sets.py b/tests/io/vasp/test_sets.py index 726e8a199fc..ec4a88bd0fc 100644 --- a/tests/io/vasp/test_sets.py +++ b/tests/io/vasp/test_sets.py @@ -91,7 +91,7 @@ def test_yb_2_warning(input_set: VaspInputSet) -> None: assert expected in str(record[0].message) -class TestSetChangeCheck(PymatgenTest): +class TestSetChangeCheck(MatSciTest): def test_sets_changed(self): msg = ( "WARNING! These tests will fail when you change an input set. They are included " @@ -128,7 +128,7 @@ def test_sets_changed(self): assert hash_str == known_hashes[input_set], f"{input_set=}\n{msg}" -class TestVaspInputSet(PymatgenTest): +class TestVaspInputSet(MatSciTest): @classmethod def setup_class(cls): filepath = f"{VASP_IN_DIR}/POSCAR" @@ -165,7 +165,7 @@ def test_as_dict(self): assert dict_set.potcar_functional == dict_set.user_potcar_functional -class TestMITMPRelaxSet(PymatgenTest): +class TestMITMPRelaxSet(MatSciTest): @classmethod def setup_class(cls): cls.set = MITRelaxSet @@ -718,7 +718,7 @@ def test_get_nedos(self): assert vis._get_nedos(0.1) == pytest.approx(741, abs=1) -class TestMPStaticSet(PymatgenTest): +class TestMPStaticSet(MatSciTest): def setup_method(self): self.set = MPStaticSet @@ -870,7 +870,7 @@ def test_grid_size_from_struct(self): ) -class TestMatPESStaticSet(PymatgenTest): +class TestMatPESStaticSet(MatSciTest): def setup_method(self): self.struct = Structure.from_file(f"{VASP_IN_DIR}/POSCAR") self.prev_incar = Incar.from_file(f"{VASP_IN_DIR}/INCAR") @@ -987,7 +987,7 @@ def test_from_prev_calc(self): assert vis.kpoints is None -class TestMPNonSCFSet(PymatgenTest): +class TestMPNonSCFSet(MatSciTest): def setup_method(self): self.set = MPNonSCFSet @@ -1153,7 +1153,7 @@ def test_user_kpoint_override(self): assert vis.kpoints.style == Kpoints.supported_modes.Gamma -class TestMagmomLdau(PymatgenTest): +class TestMagmomLdau(MatSciTest): def test_structure_from_prev_run(self): vrun = Vasprun(f"{VASP_OUT_DIR}/vasprun.magmom_ldau.xml.gz") structure = vrun.final_structure @@ -1188,7 +1188,7 @@ def test_ln_magmom(self): assert vis.incar["MAGMOM"] == magmom_ans -class TestMITMDSet(PymatgenTest): +class TestMITMDSet(MatSciTest): def setup_method(self): self.set = MITMDSet filepath = f"{VASP_IN_DIR}/POSCAR" @@ -1230,7 +1230,7 @@ def test_user_heat_speed(self): @skip_if_no_psp_dir -class TestMVLNPTMDSet(PymatgenTest): +class TestMVLNPTMDSet(MatSciTest): def setup_method(self): file_path = f"{VASP_IN_DIR}/POSCAR" self.struct = Structure.from_file(file_path) @@ -1266,7 +1266,7 @@ def test_as_from_dict(self): assert input_set.incar["NSW"] == 1000 -class TestMPMDSet(PymatgenTest): +class TestMPMDSet(MatSciTest): def setup_method(self): filepath = f"{VASP_IN_DIR}/POSCAR" self.struct = Structure.from_file(filepath) @@ -1308,7 +1308,7 @@ def test_as_from_dict(self): assert v.incar["NSW"] == 1000 -class TestMITNEBSet(PymatgenTest): +class TestMITNEBSet(MatSciTest): def setup_method(self): c1 = [[0.5] * 3, [0.9] * 3] c2 = [[0.5] * 3, [0.9, 0.1, 0.1]] @@ -1356,7 +1356,7 @@ def test_write_input(self): assert not os.path.isfile("04/POSCAR") -class TestMPSOCSet(PymatgenTest): +class TestMPSOCSet(MatSciTest): def setup_method(self): self.set = MPSOCSet @@ -1393,7 +1393,7 @@ def test_override_from_prev_calc(self): assert vis.incar["SIGMA"] == 0.025 -class TestMPNMRSet(PymatgenTest): +class TestMPNMRSet(MatSciTest): def test_incar(self): filepath = f"{TEST_FILES_DIR}/cif/Li.cif" structure = Structure.from_file(filepath) @@ -1415,7 +1415,7 @@ def test_incar(self): @skip_if_no_psp_dir -class TestMVLSlabSet(PymatgenTest): +class TestMVLSlabSet(MatSciTest): def setup_method(self): self.set = MVLSlabSet struct = self.get_structure("Li2O") @@ -1487,7 +1487,7 @@ def test_as_from_dict(self): assert "structure" not in self.vis.as_dict(verbosity=1) -class TestMVLElasticSet(PymatgenTest): +class TestMVLElasticSet(MatSciTest): def test_incar(self): mvlparam = MVLElasticSet(self.get_structure("Graphite")) incar = mvlparam.incar @@ -1498,7 +1498,7 @@ def test_incar(self): @skip_if_no_psp_dir -class TestMVLGWSet(PymatgenTest): +class TestMVLGWSet(MatSciTest): def setup_method(self): self.set = MVLGWSet self.struct = PymatgenTest.get_structure("Li2O") @@ -1576,7 +1576,7 @@ def test_bse(self): assert mvlgwgbse1.incar["ALGO"] == "Bse" -class TestMPHSERelaxSet(PymatgenTest): +class TestMPHSERelaxSet(MatSciTest): def setup_method(self): self.structure = dummy_structure self.set = MPHSERelaxSet @@ -1643,7 +1643,7 @@ def test_override_from_prev_calc(self): assert "VDW_S8" in vis_bj.incar -class TestMPHSEBS(PymatgenTest): +class TestMPHSEBS(MatSciTest): def setup_method(self): self.set = MPHSEBSSet @@ -1699,7 +1699,7 @@ def test_override_from_prev_calc(self): assert len(vis.kpoints.kpts) == 180 -class TestMVLScanRelaxSet(PymatgenTest): +class TestMVLScanRelaxSet(MatSciTest): def setup_method(self): self.set = MVLScanRelaxSet file_path = f"{VASP_IN_DIR}/POSCAR" @@ -1777,7 +1777,7 @@ def test_as_from_dict(self): assert v.user_incar_settings["NSW"] == 500 -class TestMPScanRelaxSet(PymatgenTest): +class TestMPScanRelaxSet(MatSciTest): def setup_method(self): file_path = f"{VASP_IN_DIR}/POSCAR" self.struct = Structure.from_file(file_path) @@ -1898,7 +1898,7 @@ def test_write_input(self): assert os.path.isfile(f"{self.tmp_path}/POSCAR") -class TestMPScanStaticSet(PymatgenTest): +class TestMPScanStaticSet(MatSciTest): def setup_method(self): self.set = MPScanStaticSet self.prev_run = f"{TEST_DIR}/fixtures/scan_relaxation" @@ -1988,7 +1988,7 @@ def test_override_from_prev_calc(self): assert lepsilon_vis.incar.get("NPAR") is None -class TestFunc(PymatgenTest): +class TestFunc(MatSciTest): @skip_if_no_psp_dir def test_batch_write_input(self): structs = list(map(PymatgenTest.get_structure, ("Li2O", "LiFePO4"))) @@ -2000,7 +2000,7 @@ def test_batch_write_input(self): @skip_if_no_psp_dir -class TestMVLGBSet(PymatgenTest): +class TestMVLGBSet(MatSciTest): def setup_method(self): filepath = f"{TEST_FILES_DIR}/cif/Li.cif" self.struct = Structure.from_file(filepath) @@ -2026,7 +2026,7 @@ def test_kpoints(self): assert kpoints.kpts == [(k_a, k_b, 1)] -class TestMVLRelax52Set(PymatgenTest): +class TestMVLRelax52Set(MatSciTest): def setup_method(self): self.set = MVLRelax52Set file_path = f"{VASP_IN_DIR}/POSCAR" @@ -2064,7 +2064,7 @@ def test_as_from_dict(self): assert vasp_input.incar["NSW"] == 500 -class TestLobsterSet(PymatgenTest): +class TestLobsterSet(MatSciTest): def setup_method(self): self.set = LobsterSet file_path = f"{VASP_IN_DIR}/POSCAR" @@ -2163,7 +2163,7 @@ def test_as_from_dict(self): @skip_if_no_psp_dir -class TestMPAbsorptionSet(PymatgenTest): +class TestMPAbsorptionSet(MatSciTest): def setup_method(self): file_path = f"{TEST_DIR}/fixtures/absorption/static/POSCAR" self.structure = Structure.from_file(file_path) diff --git a/tests/io/xtb/test_inputs.py b/tests/io/xtb/test_inputs.py index 546386c6391..32f2f2c8030 100644 --- a/tests/io/xtb/test_inputs.py +++ b/tests/io/xtb/test_inputs.py @@ -12,7 +12,7 @@ EXPECTED_DIR = f"{TEST_FILES_DIR}/io/xtb/expected_output" -class TestCRESTInput(PymatgenTest): +class TestCRESTInput(MatSciTest): """ Checks that all attributes of CRESTInput match the expected values for sample inputs. diff --git a/tests/io/xtb/test_outputs.py b/tests/io/xtb/test_outputs.py index c4d3fe69777..2bd19d6c6a6 100644 --- a/tests/io/xtb/test_outputs.py +++ b/tests/io/xtb/test_outputs.py @@ -23,7 +23,7 @@ EXPECTED_DIR = f"{TEST_FILES_DIR}/io/xtb/expected_output" -class TestCRESTOutput(PymatgenTest): +class TestCRESTOutput(MatSciTest): """ Checks that all attributes of CRESTOutput match the expected values for a sample CREST output directory. diff --git a/tests/optimization/test_neighbors.py b/tests/optimization/test_neighbors.py index cd022d34dde..f08f4929428 100644 --- a/tests/optimization/test_neighbors.py +++ b/tests/optimization/test_neighbors.py @@ -7,7 +7,7 @@ from pymatgen.util.testing import PymatgenTest -class TestNeighbors(PymatgenTest): +class TestNeighbors(MatSciTest): def setup_method(self): self.lattice = Lattice.cubic(10.0) self.cubic = self.lattice diff --git a/tests/phonon/test_bandstructure.py b/tests/phonon/test_bandstructure.py index ac6727628cf..0bccefb6399 100644 --- a/tests/phonon/test_bandstructure.py +++ b/tests/phonon/test_bandstructure.py @@ -13,7 +13,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/electronic_structure/bandstructure" -class TestPhononBandStructureSymmLine(PymatgenTest): +class TestPhononBandStructureSymmLine(MatSciTest): def setup_method(self): with open(f"{TEST_DIR}/NaCl_phonon_bandstructure.json") as file: dct = json.load(file) diff --git a/tests/phonon/test_dos.py b/tests/phonon/test_dos.py index a1c14cd00b2..16164585bf1 100644 --- a/tests/phonon/test_dos.py +++ b/tests/phonon/test_dos.py @@ -14,7 +14,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/phonon/dos" -class TestPhononDos(PymatgenTest): +class TestPhononDos(MatSciTest): def setup_method(self): with open(f"{TEST_DIR}/NaCl_ph_dos.json") as file: self.dos = PhononDos.from_dict(json.load(file)) @@ -182,7 +182,7 @@ def test_dos_fp_exceptions(self): self.dos.get_dos_fp_similarity(dos_fp, dos_fp2, col=1, metric=metric, normalize=False) -class TestCompletePhononDos(PymatgenTest): +class TestCompletePhononDos(MatSciTest): def setup_method(self): with open(f"{TEST_DIR}/NaCl_complete_ph_dos.json") as file: self.cdos = CompletePhononDos.from_dict(json.load(file)) diff --git a/tests/phonon/test_gruneisen.py b/tests/phonon/test_gruneisen.py index fac97aaebab..12298435cd9 100644 --- a/tests/phonon/test_gruneisen.py +++ b/tests/phonon/test_gruneisen.py @@ -21,7 +21,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/phonon/gruneisen" -class TestGruneisenPhononBandStructureSymmLine(PymatgenTest): +class TestGruneisenPhononBandStructureSymmLine(MatSciTest): def setup_method(self) -> None: self.bs_symm_line = get_gruneisen_ph_bs_symm_line( gruneisen_path=f"{TEST_DIR}/gruneisen_eq_plus_minus_InP.yaml", @@ -76,7 +76,7 @@ def test_as_dict_from_dict(self): @pytest.mark.skipif(TotalDos is None, reason="Phonopy not present") -class TestGruneisenParameter(PymatgenTest): +class TestGruneisenParameter(MatSciTest): def setup_method(self) -> None: self.gruneisen_obj = get_gruneisenparameter( f"{TEST_DIR}/gruneisen_mesh_InP.yaml", diff --git a/tests/phonon/test_ir_spectra.py b/tests/phonon/test_ir_spectra.py index 07fa82e678b..b910b86f11e 100644 --- a/tests/phonon/test_ir_spectra.py +++ b/tests/phonon/test_ir_spectra.py @@ -5,7 +5,7 @@ from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest -class TestIRDielectricTensor(PymatgenTest): +class TestIRDielectricTensor(MatSciTest): def setup_method(self): self.ir_spectra = loadfn(f"{TEST_FILES_DIR}/phonon/dos/ir_spectra_mp-991652_DDB.json") diff --git a/tests/phonon/test_thermal_displacements.py b/tests/phonon/test_thermal_displacements.py index 23afe16e670..40b49d1df17 100644 --- a/tests/phonon/test_thermal_displacements.py +++ b/tests/phonon/test_thermal_displacements.py @@ -11,7 +11,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/phonon/thermal_displacement_matrices" -class TestThermalDisplacement(PymatgenTest): +class TestThermalDisplacement(MatSciTest): """Test data from J. George's matlab code https://github.com/JaGeo/MolecularToolbox.""" def setup_method(self) -> None: diff --git a/tests/symmetry/test_analyzer.py b/tests/symmetry/test_analyzer.py index 7500b959576..f67c9576b8c 100644 --- a/tests/symmetry/test_analyzer.py +++ b/tests/symmetry/test_analyzer.py @@ -23,7 +23,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/symmetry/analyzer" -class TestSpacegroupAnalyzer(PymatgenTest): +class TestSpacegroupAnalyzer(MatSciTest): def setup_method(self): self.structure = Structure.from_file(f"{VASP_IN_DIR}/POSCAR") self.sg = SpacegroupAnalyzer(self.structure, 0.001) @@ -536,7 +536,7 @@ def test_are_symmetrically_equivalent(self): ) -class TestPointGroupAnalyzer(PymatgenTest): +class TestPointGroupAnalyzer(MatSciTest): def test_spherical(self): pg_analyzer = PointGroupAnalyzer(CH4) assert pg_analyzer.sch_symbol == "Td" diff --git a/tests/symmetry/test_kpath_hin.py b/tests/symmetry/test_kpath_hin.py index 2a7cce41712..08ae60e71bb 100644 --- a/tests/symmetry/test_kpath_hin.py +++ b/tests/symmetry/test_kpath_hin.py @@ -11,7 +11,7 @@ pytest.importorskip("seekpath", reason="seekpath not installed") -class TestKPathSeek(PymatgenTest): +class TestKPathSeek(MatSciTest): def test_kpath_generation(self): triclinic = [1, 2] monoclinic = range(3, 16) diff --git a/tests/symmetry/test_kpath_lm.py b/tests/symmetry/test_kpath_lm.py index 479ffecb65d..2151cff606a 100644 --- a/tests/symmetry/test_kpath_lm.py +++ b/tests/symmetry/test_kpath_lm.py @@ -11,7 +11,7 @@ from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest -class TestKPathLatimerMunro(PymatgenTest): +class TestKPathLatimerMunro(MatSciTest): def test_kpath_generation(self): triclinic = [1, 2] monoclinic = range(3, 16) diff --git a/tests/symmetry/test_kpath_sc.py b/tests/symmetry/test_kpath_sc.py index d88c97f79dd..ed465262f55 100644 --- a/tests/symmetry/test_kpath_sc.py +++ b/tests/symmetry/test_kpath_sc.py @@ -11,7 +11,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/symmetry/space_group_structs" -class TestBandStructureSC(PymatgenTest): +class TestBandStructureSC(MatSciTest): def test_kpath_generation(self): triclinic = [1, 2] monoclinic = range(3, 16) diff --git a/tests/symmetry/test_kpaths.py b/tests/symmetry/test_kpaths.py index 87c8bd16480..1d252a396a8 100644 --- a/tests/symmetry/test_kpaths.py +++ b/tests/symmetry/test_kpaths.py @@ -17,7 +17,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/electronic_structure/bandstructure" -class TestHighSymmKpath(PymatgenTest): +class TestHighSymmKpath(MatSciTest): @pytest.mark.skipif(get_path is None, reason="No seek path present.") def test_kpath_generation(self): triclinic = [1, 2] diff --git a/tests/symmetry/test_maggroups.py b/tests/symmetry/test_maggroups.py index 21475b7a4c9..2b474285836 100644 --- a/tests/symmetry/test_maggroups.py +++ b/tests/symmetry/test_maggroups.py @@ -17,7 +17,7 @@ __date__ = "Feb 2017" -class TestMagneticSpaceGroup(PymatgenTest): +class TestMagneticSpaceGroup(MatSciTest): def setup_method(self): self.msg_1 = MagneticSpaceGroup([70, 530]) self.msg_2 = MagneticSpaceGroup([62, 448]) diff --git a/tests/symmetry/test_site_symmetries.py b/tests/symmetry/test_site_symmetries.py index 24bb53b22e8..c2d4159cf0b 100644 --- a/tests/symmetry/test_site_symmetries.py +++ b/tests/symmetry/test_site_symmetries.py @@ -18,7 +18,7 @@ TEST_DIR = f"{TEST_FILES_DIR}/symmetry/site_symmetries" -class TestSiteSymmetries(PymatgenTest): +class TestSiteSymmetries(MatSciTest): def setup_method(self): with gzip.open(f"{TEST_DIR}/point_ops.json.gz", mode="rt") as file: self.point_ops = MontyDecoder().process_decoded(json.load(file)) diff --git a/tests/transformations/test_advanced_transformations.py b/tests/transformations/test_advanced_transformations.py index 1bba0acb289..3e508b89867 100644 --- a/tests/transformations/test_advanced_transformations.py +++ b/tests/transformations/test_advanced_transformations.py @@ -276,7 +276,7 @@ def test_as_dict(self): @pytest.mark.skipif(not enumlib_present, reason="enum_lib not present.") -class TestMagOrderingTransformation(PymatgenTest): +class TestMagOrderingTransformation(MatSciTest): def setup_method(self): lattice = Lattice.cubic(4.17) species = ["Ni", "O"] @@ -488,7 +488,7 @@ def test_advanced_usage(self): @pytest.mark.skipif(not enumlib_present, reason="enum_lib not present.") -class TestDopingTransformation(PymatgenTest): +class TestDopingTransformation(MatSciTest): def test_apply_transformation(self): structure = PymatgenTest.get_structure("LiFePO4") spga = SpacegroupAnalyzer(structure, 0.1) @@ -551,7 +551,7 @@ def test_find_codopant(self): assert find_codopant(Species("Fe", 2), 3) == Species("In", 3) -class TestSlabTransformation(PymatgenTest): +class TestSlabTransformation(MatSciTest): def test_apply_transformation(self): struct = self.get_structure("LiFePO4") trans = SlabTransformation([0, 0, 1], 10, 10, shift=0.25) @@ -570,7 +570,7 @@ def test_apply_transformation(self): assert_allclose(slab_from_gen.cart_coords, slab_from_trans.cart_coords) -class TestGrainBoundaryTransformation(PymatgenTest): +class TestGrainBoundaryTransformation(MatSciTest): def test_apply_transformation(self): Al_bulk = Structure.from_spacegroup("Fm-3m", Lattice.cubic(2.8575585), ["Al"], [[0, 0, 0]]) gb_gen_params_s5 = { @@ -590,7 +590,7 @@ def test_apply_transformation(self): assert_allclose(gb_from_generator.cart_coords, gb_from_trans.cart_coords) -class TestDisorderedOrderedTransformation(PymatgenTest): +class TestDisorderedOrderedTransformation(MatSciTest): def test_apply_transformation(self): # nonsensical example just for testing purposes struct = self.get_structure("BaNiO3") @@ -603,7 +603,7 @@ def test_apply_transformation(self): @pytest.mark.skipif(not mcsqs_cmd, reason="mcsqs not present.") -class TestSQSTransformation(PymatgenTest): +class TestSQSTransformation(MatSciTest): def test_apply_transformation(self): pzt_structs = loadfn(f"{TEST_FILES_DIR}/io/atat/mcsqs/pzt-structs.json") trans = SQSTransformation(scaling=[2, 1, 1], search_time=0.01, instances=1, wd=0) @@ -649,7 +649,7 @@ def test_spin(self): @pytest.mark.skipif(ClusterSpace is None, reason="icet not installed.") -class TestSQSTransformationIcet(PymatgenTest): +class TestSQSTransformationIcet(MatSciTest): stored_run: dict = loadfn(f"{TEST_FILES_DIR}/transformations/icet-sqs-fcc-Mg_75-Al_25-scaling_8.json.gz") scaling: int = 8 @@ -699,7 +699,7 @@ def test_monte_carlo(self): assert isinstance(sqs_output[0][key], val) -class TestCubicSupercellTransformation(PymatgenTest): +class TestCubicSupercellTransformation(MatSciTest): def test_apply_transformation_cubic_supercell(self): structure = self.get_structure("TlBiSe2") min_atoms = 100 @@ -848,7 +848,7 @@ def test_apply_transformation_orthorhombic_supercell(self): assert transformed_cubic.lattice.angles == transformed_orthorhombic.lattice.angles -class TestAddAdsorbateTransformation(PymatgenTest): +class TestAddAdsorbateTransformation(MatSciTest): def test_apply_transformation(self): co = Molecule(["C", "O"], [[0, 0, 0], [0, 0, 1.23]]) trans = AddAdsorbateTransformation(co) @@ -859,7 +859,7 @@ def test_apply_transformation(self): assert out.reduced_formula == "Pt4CO" -class TestSubstituteSurfaceSiteTransformation(PymatgenTest): +class TestSubstituteSurfaceSiteTransformation(MatSciTest): def test_apply_transformation(self): trans = SubstituteSurfaceSiteTransformation("Au") pt = Structure(Lattice.cubic(5), ["Pt"], [[0, 0, 0]]) # fictitious @@ -870,7 +870,7 @@ def test_apply_transformation(self): @pytest.mark.skipif(not hiphive, reason="hiphive not present") -class TestMonteCarloRattleTransformation(PymatgenTest): +class TestMonteCarloRattleTransformation(MatSciTest): def test_apply_transformation(self): struct = self.get_structure("Si") mcrt = MonteCarloRattleTransformation(0.01, 2, seed=1) diff --git a/tests/transformations/test_site_transformations.py b/tests/transformations/test_site_transformations.py index 8e5efebf250..e7e5be40efe 100644 --- a/tests/transformations/test_site_transformations.py +++ b/tests/transformations/test_site_transformations.py @@ -23,7 +23,7 @@ enumlib_present = enum_cmd and makestr_cmd -class TestTranslateSitesTransformation(PymatgenTest): +class TestTranslateSitesTransformation(MatSciTest): def setup_method(self): coords = [ [0, 0, 0], @@ -263,7 +263,7 @@ def test_str(self): ) -class TestAddSitePropertyTransformation(PymatgenTest): +class TestAddSitePropertyTransformation(MatSciTest): def test_apply_transformation(self): struct = self.get_structure("Li2O2") sd = [[True, True, True] for _ in struct] @@ -278,7 +278,7 @@ def test_apply_transformation(self): assert_allclose(trans_set.site_properties[prop], manually_set.site_properties[prop]) -class TestRadialSiteDistortionTransformation(PymatgenTest): +class TestRadialSiteDistortionTransformation(MatSciTest): def setup_method(self): self.molecule = Molecule( species=["C", "H", "H", "H", "H", "H", "H", "H", "H", "H", "H", "H", "H"], diff --git a/tests/util/test_io.py b/tests/util/test_io.py index 09458240656..fcd250a0bff 100644 --- a/tests/util/test_io.py +++ b/tests/util/test_io.py @@ -4,7 +4,7 @@ from pymatgen.util.testing import VASP_OUT_DIR, PymatgenTest -class TestFunc(PymatgenTest): +class TestFunc(MatSciTest): def test_micro_pyawk(self): data = [] diff --git a/tests/util/test_plotting.py b/tests/util/test_plotting.py index ec68c960d88..b8c13bd1480 100644 --- a/tests/util/test_plotting.py +++ b/tests/util/test_plotting.py @@ -12,7 +12,7 @@ pymatviz = None -class TestFunc(PymatgenTest): +class TestFunc(MatSciTest): def test_plot_periodic_heatmap(self): random_data = {"Te": 0.11083, "Au": 0.75756, "Th": 1.24758, "Ni": -2.0354} fig = periodic_table_heatmap(random_data) diff --git a/tests/vis/test_plotters.py b/tests/vis/test_plotters.py index d6f5d535117..e2838de0d5f 100644 --- a/tests/vis/test_plotters.py +++ b/tests/vis/test_plotters.py @@ -15,7 +15,7 @@ spect_data_dict = json.load(file, cls=MontyDecoder) -class TestSpectrumPlotter(PymatgenTest): +class TestSpectrumPlotter(MatSciTest): def setup_method(self): self.xanes = XAS.from_dict(spect_data_dict)