Skip to content

Commit 8a3a71d

Browse files
fmoessbauerjan-kiszka
authored andcommitted
test: check env set but not existing
Add a simple check for the error path when a env var is pointed to a non-existing path. Signed-off-by: Felix Moessbauer <[email protected]> Signed-off-by: Jan Kiszka <[email protected]>
1 parent 25e2468 commit 8a3a71d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/test_environment_variables.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import json
3131
from kas import kas
3232
from kas.context import create_global_context
33-
from kas.kasusererror import ArgsCombinationError
33+
from kas.kasusererror import ArgsCombinationError, EnvSetButNotFoundError
3434
from kas.libcmds import SetupHome
3535

3636

@@ -240,3 +240,11 @@ def test_env_file_processing(monkeykas, tmpdir):
240240
sh = SetupHome()
241241
sh.execute(ctx)
242242
assert (pathlib.Path(sh.tmpdirname) / pathlib.Path(file)).exists()
243+
244+
245+
def test_env_set_but_not_existing(monkeykas):
246+
with monkeykas.context() as mp:
247+
mp.setenv('NETRC_FILE', '/path/does/not/exist')
248+
ctx = create_global_context([])
249+
with pytest.raises(EnvSetButNotFoundError):
250+
SetupHome().execute(ctx)

0 commit comments

Comments
 (0)