From dce7e2de365d9e3eb94daeef904dec57388a506f Mon Sep 17 00:00:00 2001 From: Zhuoying Date: Wed, 6 Mar 2024 11:20:48 -0800 Subject: [PATCH] fix tests file --- .../tests/test_polarization_to_db.py | 35 +++---------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/atomate/vasp/firetasks/tests/test_polarization_to_db.py b/atomate/vasp/firetasks/tests/test_polarization_to_db.py index b85b0da70..23cb62d58 100644 --- a/atomate/vasp/firetasks/tests/test_polarization_to_db.py +++ b/atomate/vasp/firetasks/tests/test_polarization_to_db.py @@ -1,11 +1,7 @@ -<<<<<<< HEAD import os -======= import bson import gzip - from pathlib import Path ->>>>>>> 45fcce62 (Tidy polarization tests) from atomate.utils.testing import AtomateTest from atomate.vasp.firetasks.parse_outputs import PolarizationToDb @@ -13,10 +9,9 @@ __author__ = "Tess Smidt" __email__ = "blondegeek@gmail.com" -<<<<<<< HEAD -module_dir = os.path.dirname(os.path.abspath(__file__)) -db_dir = os.path.join(module_dir, "..", "..", "..", "common", "test_files") -ref_dir = os.path.join(module_dir, "..", "..", "test_files") +module_dir = Path(__file__).resolve().parent +db_dir = module_dir / "../../../common/test_files" +ref_dir = module_dir / "../../test_files" DEBUG_MODE = ( @@ -24,32 +19,14 @@ ) # If None, runs a "fake" VASP. Otherwise, runs VASP with this command... VASP_CMD = None -======= -module_dir = Path(__file__).resolve().parent -db_dir = module_dir / "../../../common/test_files" -<<<<<<< HEAD -ref_dir = module_dir / "../..//test_files" ->>>>>>> 45fcce62 (Tidy polarization tests) -======= -ref_dir = module_dir / "../../test_files" ->>>>>>> fcdf2e63 (Finish tidying polarization tests) + class TestPolarizationFiretasks(AtomateTest): def test_polarizationtodb(self): -<<<<<<< HEAD - import gzip - - import bson - - reference_dir = os.path.abspath(os.path.join(ref_dir, "ferroelectric_wf")) - - with gzip.open(os.path.join(reference_dir, "tasks.bson.gz")) as f: -======= wf_dir = ref_dir / "ferroelectric_wf" with gzip.open(wf_dir / "tasks.bson.gz") as f: ->>>>>>> 45fcce62 (Tidy polarization tests) coll_raw = f.read() coll = bson.decode_all(coll_raw) @@ -69,8 +46,4 @@ def test_polarizationtodb(self): # Check recovered change in polarization coll = self.get_task_collection("polarization_tasks") d = coll.find_one() -<<<<<<< HEAD - self.assertAlmostEqual(d["polarization_change_norm"], 46.288752795325244, 5) -======= self.assertAlmostEqual(d["polarization_change_norm"], 46.28875279532, 5) ->>>>>>> 45fcce62 (Tidy polarization tests)