diff --git a/tests/command_line/test_enumlib_caller.py b/tests/command_line/test_enumlib_caller.py index b0f134cbdd5..aa3cebff4a3 100644 --- a/tests/command_line/test_enumlib_caller.py +++ b/tests/command_line/test_enumlib_caller.py @@ -13,12 +13,11 @@ 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") -enumlib_present = enum_cmd and makestr_cmd +ENUM_CMD = which("enum.x") or which("multienum.x") +MAKESTR_CMD = which("makestr.x") or which("makeStr.x") or which("makeStr.py") -@pytest.mark.skipif(not enumlib_present, reason="enum_lib not present.") +@pytest.mark.skipif(not (ENUM_CMD and MAKESTR_CMD), reason="enumlib not present.") class TestEnumlibAdaptor(PymatgenTest): def test_init(self): struct = self.get_structure("LiFePO4") diff --git a/tests/command_line/test_gulp_caller.py b/tests/command_line/test_gulp_caller.py index c0e95072292..18c3f05c268 100644 --- a/tests/command_line/test_gulp_caller.py +++ b/tests/command_line/test_gulp_caller.py @@ -29,13 +29,15 @@ 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. Right now, it is compiled against libgfortran3, which is no longer supported in the new -# Ubuntu 20.04. -gulp_present = False +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) -@pytest.mark.skipif(not gulp_present, reason="gulp not present.") class TestGulpCaller: def test_run(self): mgo_lattice = np.eye(3) * 4.212 @@ -104,7 +106,6 @@ 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") @@ -275,7 +276,6 @@ 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 @@ -327,7 +327,6 @@ 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") @@ -355,7 +354,6 @@ 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")