Update transient processing to more narrowly scope error catching

This commit is contained in:
Ethan Paul 2020-12-16 18:47:27 -05:00
parent ff344c2b4b
commit c5c5261a80
No known key found for this signature in database
GPG Key ID: C5F5542B54A4D9C6

View File

@ -62,12 +62,10 @@ def find_transients(packages: PackageMap, dependency_name: str) -> Set[PoetryPac
"""
from tox_poetry_installer import _poetry
try:
def find_deps_of_deps(name: str, searched: Set[str]) -> PackageMap:
package = packages[name]
transients: PackageMap = {}
searched.update([name])
searched.add(name)
if name in _poetry.Provider.UNSAFE_PACKAGES:
reporter.warning(
@ -94,11 +92,11 @@ def find_transients(packages: PackageMap, dependency_name: str) -> Set[PoetryPac
return transients
searched: Set[str] = set()
try:
transients: PackageMap = find_deps_of_deps(
packages[dependency_name].name, searched
)
return set(transients.values())
except KeyError:
if any(
delimiter in dependency_name
@ -111,6 +109,8 @@ def find_transients(packages: PackageMap, dependency_name: str) -> Set[PoetryPac
f"No version of locked dependency '{dependency_name}' found in the project lockfile"
) from None
return set(transients.values())
def check_preconditions(venv: ToxVirtualEnv, action: ToxAction) -> "_poetry.Poetry":
"""Check that the local project environment meets expectations"""