Skip to content

Commit

Permalink
revert for a separate migration PR
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielYang59 committed Dec 1, 2024
1 parent 06282cf commit 6f95ba8
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 17 deletions.
10 changes: 6 additions & 4 deletions tests/command_line/test_enumlib_caller.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import unittest
from shutil import which

import numpy as np
Expand All @@ -13,11 +14,12 @@
from pymatgen.transformations.standard_transformations import SubstitutionTransformation
from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest

ENUM_CMD = which("enum.x") or which("multienum.x")
MAKESTR_CMD = which("makestr.x") or which("makeStr.x") or which("makeStr.py")
enum_cmd = which("enum.x") or which("multienum.x")
makestr_cmd = which("makestr.x") or which("makeStr.x") or which("makeStr.py")
enumlib_present = enum_cmd and makestr_cmd


@pytest.mark.skipif(not (ENUM_CMD and MAKESTR_CMD), reason="enumlib not present.")
@pytest.mark.skipif(not enumlib_present, reason="enum_lib not present.")
class TestEnumlibAdaptor(PymatgenTest):
def test_init(self):
struct = self.get_structure("LiFePO4")
Expand Down Expand Up @@ -117,7 +119,7 @@ def test_partial_disorder(self):
for struct in structures:
assert struct.formula == "Ca12 Al8 Si4 Ge8 O48"

@pytest.mark.skip("Fails seemingly at random.")
@unittest.skip("Fails seemingly at random.")
def test_timeout(self):
struct = Structure.from_file(filename=f"{TEST_FILES_DIR}/cif/garnet.cif")
SpacegroupAnalyzer(struct, 0.1)
Expand Down
19 changes: 11 additions & 8 deletions tests/command_line/test_gulp_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import unittest
from shutil import which
from unittest import TestCase

Expand All @@ -29,15 +30,13 @@

TEST_DIR = f"{TEST_FILES_DIR}/command_line/gulp"

GULP_PRESENT = which("gulp") and os.getenv("GULP_LIB") and ("win" not in sys.platform)
# Disable GULP tests for now: it is compiled against `libgfortran3``,
# which is no longer supported in Ubuntu 20.04 and onwards.
GULP_PRESENT = False

if not GULP_PRESENT:
pytest.skip(reason="GULP not available", allow_module_level=True)
gulp_present = which("gulp") and os.getenv("GULP_LIB") and ("win" not in sys.platform)
# disable gulp tests for now. Right now, it is compiled against libgfortran3, which is no longer supported in the new
# Ubuntu 20.04.
gulp_present = False


@pytest.mark.skipif(not gulp_present, reason="gulp not present.")
class TestGulpCaller:
def test_run(self):
mgo_lattice = np.eye(3) * 4.212
Expand Down Expand Up @@ -106,6 +105,7 @@ def test_decimal(self):
caller.run(buckingham_input)


@pytest.mark.skipif(not gulp_present, reason="gulp not present.")
class TestGulpIO(TestCase):
def setUp(self):
self.structure = Structure.from_file(f"{VASP_IN_DIR}/POSCAR_Al12O18")
Expand Down Expand Up @@ -271,11 +271,12 @@ def test_get_relaxed_structure(self):
assert struct.lattice.a == 4.212
assert struct.lattice.alpha == 90

@pytest.mark.skip("Test later")
@unittest.skip("Test later")
def test_tersoff_input(self):
self.gio.tersoff_input(self.structure)


@pytest.mark.skipif(not gulp_present, reason="gulp not present.")
class TestGlobalFunctions(TestCase):
def setUp(self):
mgo_latt = np.eye(3) * 4.212
Expand Down Expand Up @@ -327,6 +328,7 @@ def test_get_energy_relax_structure_buckingham(self):
assert site_len == len(self.mgo_uc)


@pytest.mark.skipif(not gulp_present, reason="gulp not present.")
class TestBuckinghamPotentialLewis(TestCase):
def setUp(self):
self.bpl = BuckinghamPotential("lewis")
Expand Down Expand Up @@ -354,6 +356,7 @@ def test_spring(self):
assert self.bpl.spring_dict["O"] != ""


@pytest.mark.skipif(not gulp_present, reason="gulp not present.")
class TestBuckinghamPotentialBush(TestCase):
def setUp(self):
self.bpb = BuckinghamPotential("bush")
Expand Down
4 changes: 2 additions & 2 deletions tests/core/test_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import json
import os
import unittest

import numpy as np
import pytest
from numpy.testing import assert_allclose
from pytest import approx

Expand Down Expand Up @@ -697,7 +697,7 @@ def test_get_d(self):
s2 = recon2.get_unreconstructed_slabs()[0]
assert get_d(s1) == approx(get_d(s2))

@pytest.mark.skip("This test relies on neighbor orders and is hard coded. Disable temporarily")
@unittest.skip("This test relies on neighbor orders and is hard coded. Disable temporarily")
def test_previous_reconstructions(self):
# Test to see if we generated all reconstruction types correctly and nothing changes

Expand Down
3 changes: 2 additions & 1 deletion tests/io/test_zeopp.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import unittest
from unittest import TestCase

import pytest
Expand Down Expand Up @@ -166,7 +167,7 @@ def test_get_voronoi_nodes(self):
assert isinstance(vor_face_center_struct, Structure)


@pytest.mark.skip("TODO: file free_sph.cif not present")
@unittest.skip("TODO: file free_sph.cif not present")
class TestGetFreeSphereParams(TestCase):
def setUp(self):
filepath = f"{TEST_FILES_DIR}/cif/free_sph.cif"
Expand Down
5 changes: 3 additions & 2 deletions tests/io/vasp/test_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import hashlib
import os
import unittest
from glob import glob
from zipfile import ZipFile

Expand Down Expand Up @@ -1606,7 +1607,7 @@ def test_user_incar_settings(self):
assert not vis.incar["LASPH"], "LASPH user setting not applied"
assert vis.incar["VDW_SR"] == 1.5, "VDW_SR user setting not applied"

@pytest.mark.skipif(not os.path.exists(TEST_DIR), reason="Test files are not present.")
@unittest.skipIf(not os.path.exists(TEST_DIR), "Test files are not present.")
def test_from_prev_calc(self):
prev_run = os.path.join(TEST_DIR, "fixtures", "relaxation")

Expand All @@ -1623,7 +1624,7 @@ def test_from_prev_calc(self):
assert "VDW_A2" in vis_bj.incar
assert "VDW_S8" in vis_bj.incar

@pytest.mark.skipif(not os.path.exists(TEST_DIR), reason="Test files are not present.")
@unittest.skipIf(not os.path.exists(TEST_DIR), "Test files are not present.")
def test_override_from_prev_calc(self):
prev_run = os.path.join(TEST_DIR, "fixtures", "relaxation")

Expand Down

0 comments on commit 6f95ba8

Please sign in to comment.