File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -2277,9 +2277,7 @@ def from_symbol_and_functional(
22772277 functional_subdir = SETTINGS .get ("PMG_VASP_PSP_SUB_DIRS" , {}).get (functional , cls .functional_dir [functional ])
22782278 PMG_VASP_PSP_DIR = SETTINGS .get ("PMG_VASP_PSP_DIR" )
22792279 if PMG_VASP_PSP_DIR is None :
2280- raise PmgVaspPspDirError (
2281- f"No POTCAR for { symbol } with { functional = } found. Please set the PMG_VASP_PSP_DIR in .pmgrc.yaml."
2282- )
2280+ raise PmgVaspPspDirError ("Set PMG_VASP_PSP_DIR=<directory-path> in .pmgrc.yaml (needed to find POTCARs)" )
22832281 if not os .path .isdir (PMG_VASP_PSP_DIR ):
22842282 raise FileNotFoundError (f"{ PMG_VASP_PSP_DIR = } does not exist." )
22852283
Original file line number Diff line number Diff line change 2828 Incar ,
2929 Kpoints ,
3030 KpointsSupportedModes ,
31+ PmgVaspPspDirError ,
3132 Poscar ,
3233 Potcar ,
3334 PotcarSingle ,
@@ -1211,7 +1212,16 @@ def test_from_symbol_and_functional_raises(self):
12111212 # test FileNotFoundError on non-existent PMG_VASP_PSP_DIR in SETTINGS
12121213 PMG_VASP_PSP_DIR = "missing-dir"
12131214 symbol , functional = "Fe" , "PBE_64"
1214- with (
1215+ with ( # test PMG_VASP_PSP_DIR not set in SETTINGS
1216+ patch .dict (SETTINGS , PMG_VASP_PSP_DIR = None ),
1217+ pytest .raises (
1218+ PmgVaspPspDirError ,
1219+ match = re .escape ("Set PMG_VASP_PSP_DIR=<directory-path> in .pmgrc.yaml (needed to find POTCARs)" ),
1220+ ),
1221+ ):
1222+ PotcarSingle .from_symbol_and_functional (symbol , functional )
1223+
1224+ with ( # test FileNotFoundError on non-existent PMG_VASP_PSP_DIR in SETTINGS
12151225 patch .dict (SETTINGS , PMG_VASP_PSP_DIR = PMG_VASP_PSP_DIR ),
12161226 pytest .raises (FileNotFoundError , match = f"{ PMG_VASP_PSP_DIR = } does not exist." ),
12171227 ):
You can’t perform that action at this time.
0 commit comments