mirror of
				https://github.com/enpaul/tox-poetry-installer.git
				synced 2025-11-04 07:46:06 +00:00 
			
		
		
		
	Fix handling of nonexistent extras with custom app exception
This commit is contained in:
		@@ -72,6 +72,10 @@ class LockedDepNotFoundError(ToxPoetryInstallerException):
 | 
				
			|||||||
    """Locked dependency was not found in the lockfile"""
 | 
					    """Locked dependency was not found in the lockfile"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class ExtraNotFoundError(ToxPoetryInstallerException):
 | 
				
			||||||
 | 
					    """Project package extra not defined in project's pyproject.toml"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def _sort_env_deps(venv: ToxVirtualEnv) -> _SortedEnvDeps:
 | 
					def _sort_env_deps(venv: ToxVirtualEnv) -> _SortedEnvDeps:
 | 
				
			||||||
    """Sorts the environment dependencies by lock status
 | 
					    """Sorts the environment dependencies by lock status
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -221,13 +225,18 @@ def _install_package_dependencies(
 | 
				
			|||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    base_dependencies = [
 | 
					    base_dependencies = [
 | 
				
			||||||
        packages[item.name] for item in poetry.packages.requires if not item.is_optional
 | 
					        packages[item.name] for item in poetry.package.requires if not item.is_optional
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for extra in venv.envconfig.extras:
 | 
					    for extra in venv.envconfig.extras:
 | 
				
			||||||
 | 
					        try:
 | 
				
			||||||
            extra_dependencies = [
 | 
					            extra_dependencies = [
 | 
				
			||||||
                packages[item.name] for item in poetry.package.extras[extra]
 | 
					                packages[item.name] for item in poetry.package.extras[extra]
 | 
				
			||||||
            ]
 | 
					            ]
 | 
				
			||||||
 | 
					        except KeyError:
 | 
				
			||||||
 | 
					            raise ExtraNotFoundError(
 | 
				
			||||||
 | 
					                f"Environment '{venv.name}' specifies project extra '{extra}' which was not found in the lockfile"
 | 
				
			||||||
 | 
					            ) from None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dependencies: List[PoetryPackage] = []
 | 
					    dependencies: List[PoetryPackage] = []
 | 
				
			||||||
    for dep in base_dependencies + extra_dependencies:
 | 
					    for dep in base_dependencies + extra_dependencies:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user