From 7e64b5b08d8172012a6fec191d38e3ec2034c25c Mon Sep 17 00:00:00 2001 From: "Haoyu (Daniel)" Date: Thu, 18 Apr 2024 23:04:11 +0800 Subject: [PATCH] fix some paths --- tests/analysis/test_graphs.py | 4 ++-- tests/electronic_structure/test_plotter.py | 2 +- tests/io/test_adf.py | 8 ++++---- tests/io/test_cif.py | 2 +- tests/io/vasp/test_outputs.py | 6 +++--- tests/phonon/test_thermal_displacements.py | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/analysis/test_graphs.py b/tests/analysis/test_graphs.py index a0d6774fe93..ead5c1404c4 100644 --- a/tests/analysis/test_graphs.py +++ b/tests/analysis/test_graphs.py @@ -87,10 +87,10 @@ def setUp(self): # MoS2 example, structure graph obtained from critic2 # (not ground state, from mp-1023924, single layer) - stdout_file = f"{TEST_FILES_DIR}/critic2/MoS2_critic2_stdout.txt" + stdout_file = f"{TEST_FILES_DIR}/command_line/critic2/MoS2_critic2_stdout.txt" with open(stdout_file) as txt_file: reference_stdout = txt_file.read() - self.structure = Structure.from_file(f"{TEST_FILES_DIR}/critic2/MoS2.cif") + self.structure = Structure.from_file(f"{TEST_FILES_DIR}/command_line/critic2/MoS2.cif") c2o = Critic2Analysis(self.structure, reference_stdout) self.mos2_sg = c2o.structure_graph(include_critical_points=False) diff --git a/tests/electronic_structure/test_plotter.py b/tests/electronic_structure/test_plotter.py index a25f09baa1b..fda18ccdc4e 100644 --- a/tests/electronic_structure/test_plotter.py +++ b/tests/electronic_structure/test_plotter.py @@ -249,7 +249,7 @@ def test_methods(self): class TestPlotBZ(TestCase): def setUp(self): - self.rec_latt = Structure.from_file(f"{TEST_FILES_DIR}/cssr/Si.cssr").lattice.reciprocal_lattice + self.rec_latt = Structure.from_file(f"{TEST_FILES_DIR}/io/cssr/Si.cssr").lattice.reciprocal_lattice self.kpath = [[[0.0, 0.0, 0.0], [0.5, 0.0, 0.5], [0.5, 0.25, 0.75], [0.375, 0.375, 0.75]]] self.labels = { "\\Gamma": [0.0, 0.0, 0.0], diff --git a/tests/io/test_adf.py b/tests/io/test_adf.py index 7762cdb0671..d3b6785320f 100644 --- a/tests/io/test_adf.py +++ b/tests/io/test_adf.py @@ -250,13 +250,13 @@ def test_main(self): task = AdfTask("optimize", **rhb18) inp = AdfInput(task) inp.write_file(mol, tmp_file) - expected = readfile(f"{TEST_DIR}/adf/RhB18_adf.inp") + expected = readfile(f"{TEST_DIR}/RhB18_adf.inp") assert readfile(tmp_file) == expected class TestAdfOutput: def test_analytical_freq(self): - filename = f"{TEST_DIR}/adf/analytical_freq/adf.out" + filename = f"{TEST_DIR}/analytical_freq/adf.out" adf_out = AdfOutput(filename) assert adf_out.final_energy == approx(-0.54340325) assert len(adf_out.energies) == 4 @@ -269,7 +269,7 @@ def test_analytical_freq(self): assert adf_out.normal_modes[0][8] == approx(-0.562) def test_numerical_freq(self): - filename = f"{TEST_DIR}/adf/numerical_freq/adf.out" + filename = f"{TEST_DIR}/numerical_freq/adf.out" adf_out = AdfOutput(filename) assert adf_out.freq_type == "Numerical" assert len(adf_out.final_structure) == 4 @@ -285,7 +285,7 @@ def test_numerical_freq(self): assert adf_out.normal_modes[1][9] == approx(-0.536) def test_single_point(self): - filename = f"{TEST_DIR}/adf/sp/adf.out" + filename = f"{TEST_DIR}/sp/adf.out" adf_out = AdfOutput(filename) assert adf_out.final_energy == approx(-0.74399276) assert len(adf_out.final_structure) == 4 diff --git a/tests/io/test_cif.py b/tests/io/test_cif.py index 9c52b7a118b..fb98257889d 100644 --- a/tests/io/test_cif.py +++ b/tests/io/test_cif.py @@ -543,7 +543,7 @@ def test_disordered(self): assert l1.strip() == l2.strip() def test_cif_writer_without_refinement(self): - si2 = Structure.from_file(f"{TEST_FILES_DIR}/abinit/si.cif") + si2 = Structure.from_file(f"{TEST_FILES_DIR}/io/abinit/si.cif") writer = CifWriter(si2, symprec=1e-3, significant_figures=10, refine_struct=False) cif_str = str(writer) diff --git a/tests/io/vasp/test_outputs.py b/tests/io/vasp/test_outputs.py index d82172fb899..f70161dbeed 100644 --- a/tests/io/vasp/test_outputs.py +++ b/tests/io/vasp/test_outputs.py @@ -1913,11 +1913,11 @@ def test_get_parchg(self): assert_allclose(c.data["total"], 0.0) def test_write_unks(self): - unk_std = Unk.from_file(f"{TEST_FILES_DIR}/wannier90/UNK.N2.std") - unk_ncl = Unk.from_file(f"{TEST_FILES_DIR}/wannier90/UNK.H2.ncl") + unk_std = Unk.from_file(f"{TEST_FILES_DIR}/io/wannier90/UNK.N2.std") + unk_ncl = Unk.from_file(f"{TEST_FILES_DIR}/io/wannier90/UNK.H2.ncl") with pytest.raises(ValueError, match="invalid directory"): - self.wavecar.write_unks(f"{TEST_FILES_DIR}/wannier90/UNK.N2.std") + self.wavecar.write_unks(f"{TEST_FILES_DIR}/io/wannier90/UNK.N2.std") # different grids self.wavecar.write_unks("./unk_dir") diff --git a/tests/phonon/test_thermal_displacements.py b/tests/phonon/test_thermal_displacements.py index b86c0752fbe..a91a71bd899 100644 --- a/tests/phonon/test_thermal_displacements.py +++ b/tests/phonon/test_thermal_displacements.py @@ -8,7 +8,7 @@ from pymatgen.phonon.thermal_displacements import ThermalDisplacementMatrices from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest -TEST_DIR = TEST_FILES_DIR / "phonopy" +TEST_DIR = f"{TEST_FILES_DIR}/io/phonopy" class TestThermalDisplacement(PymatgenTest):