Commit c15ec4c2 authored by Piergiorgio Pancino's avatar Piergiorgio Pancino
Browse files

Merge branch '1504-load_script-raise-exception' into 'master'

Resolve "`load_script` does't raise exception if the file does not exists"

Closes #1504

See merge request !2296
parents 5a8692cf 3914ec8e
Pipeline #24024 passed with stages
in 4 minutes and 30 seconds
......@@ -418,6 +418,8 @@ class Session:
self.env_dict[k] = globals_dict[k]
finally:
sys.meta_path.remove(importer)
else:
raise RuntimeError(f"{session.name} session has no script module path")
def _get_user_script_home(self):
return self.__user_script_homedir.get()
......
......@@ -98,6 +98,9 @@ def test_load_script(session2, session4, capsys):
session4.setup(env_dict)
assert "RuntimeError" in capsys.readouterr()[1]
with pytest.raises(RuntimeError):
load_script("doesnotexist")
def test_load_script_namespace(session4):
env_dict = dict()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment