testing: catch correct exception on env var check
KeyError is raised when attempting to access an unset environment
variable. It should be handled by defaulting to a setting, as this
happens in devenv when running pytest directly outside a venv.
@@ -142,9 +142,8 @@ def test_session_root_path():
try:
root_path = os.environ[ENV_TMPDIR_VAR]
- except Exception:
+ except KeyError:
root_path = DEFAULT_ROOT_TESTSESSION_PATH
- raise Exception
if not os.path.exists(root_path):
os.makedirs(root_path)
