Skip to content

Commit

Permalink
fix tests file
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhuoying committed Mar 6, 2024
1 parent c6a5747 commit dce7e2d
Showing 1 changed file with 4 additions and 31 deletions.
35 changes: 4 additions & 31 deletions atomate/vasp/firetasks/tests/test_polarization_to_db.py
Original file line number Diff line number Diff line change
@@ -1,55 +1,32 @@
<<<<<<< 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

__author__ = "Tess Smidt"
__email__ = "[email protected]"

<<<<<<< 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 = (
True # If true, retains the database and output dirs at the end of the test
)
# 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)
Expand All @@ -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)

0 comments on commit dce7e2d

Please sign in to comment.