From c3e11d6e1768b3b347f1e8e98ae00dbc7aa02548 Mon Sep 17 00:00:00 2001 From: Janosh Riebesell Date: Fri, 18 Aug 2023 18:38:31 -0700 Subject: [PATCH] pmg test_entrypoint run in tmp_path --- tests/test_cli.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index d5376fc703c..64455f48de5 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,20 +1,26 @@ from __future__ import annotations import os +from typing import TYPE_CHECKING from pymatgen.util.testing import TEST_FILES_DIR +if TYPE_CHECKING: + from pathlib import Path + + from pytest import MonkeyPatch + + +def test_entrypoint(tmp_path: Path, monkeypatch: MonkeyPatch): + monkeypatch.chdir(tmp_path) -def test_entrypoint(): exit_status = os.system(f"pmg analyze {TEST_FILES_DIR}/scan_relaxation") assert exit_status == 0 assert os.path.exists("vasp_data.gz") - os.remove("vasp_data.gz") exit_status = os.system(f"pmg structure --convert --filenames {TEST_FILES_DIR}/Li2O.cif POSCAR.Li2O.test") assert exit_status == 0 assert os.path.exists("POSCAR.Li2O.test") - os.remove("POSCAR.Li2O.test") exit_status = os.system(f"pmg structure --symmetry 0.1 --filenames {TEST_FILES_DIR}/Li2O.cif") assert exit_status == 0