Add import exception to Poetry import error message

Fixes #96
This commit is contained in:
Ethan Paul 2024-08-13 13:08:12 -04:00
parent 62f90de297
commit fdaee670c4
Signed by: enpaul
GPG Key ID: 07F53B438281D181
2 changed files with 4 additions and 4 deletions

View File

@ -37,7 +37,7 @@ try:
from poetry.installation.operations.install import Install
from poetry.poetry import Poetry
from poetry.utils.env import VirtualEnv
except ImportError:
except ImportError as err:
raise exceptions.PoetryNotInstalledError(
f"No version of Poetry could be imported under the current environment for '{sys.executable}'"
f"Failed to import a supported version of Poetry under the current environment '{sys.executable}': {err}"
) from None

View File

@ -46,9 +46,9 @@ def check_preconditions(venv: ToxVirtualEnv) -> "_poetry.Poetry":
#
# ``RuntimeError`` is dangerous to blindly catch because it can be (and in Poetry's case,
# is) raised in many different places for different purposes.
except RuntimeError:
except RuntimeError as err:
raise exceptions.SkipEnvironment(
"Project does not use Poetry for env management, skipping installation of locked dependencies"
f"Skipping installation of locked dependencies due to a Poetry error: {err}"
) from None