Merge pull request #26 from enpaul/enp/fixups

Minor fixups ahead of 0.5 release
This commit is contained in:
Ethan Paul 2020-11-12 19:47:09 -05:00 committed by GitHub
commit b9b0eba90f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 7 deletions

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "tox-poetry-installer" name = "tox-poetry-installer"
version = "0.4.0" version = "0.5.0"
license = "MIT" license = "MIT"
authors = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"] authors = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]
description = "Tox plugin to install Tox environment dependencies using the Poetry backend and lockfile" description = "Tox plugin to install Tox environment dependencies using the Poetry backend and lockfile"

View File

@ -1,7 +1,7 @@
# pylint: disable=missing-docstring # pylint: disable=missing-docstring
__title__ = "tox-poetry-installer" __title__ = "tox-poetry-installer"
__summary__ = "Tox plugin to install Tox environment dependencies using the Poetry backend and lockfile" __summary__ = "Tox plugin to install Tox environment dependencies using the Poetry backend and lockfile"
__version__ = "0.4.0" __version__ = "0.5.0"
__url__ = "https://github.com/enpaul/tox-poetry-installer/" __url__ = "https://github.com/enpaul/tox-poetry-installer/"
__license__ = "MIT" __license__ = "MIT"
__authors__ = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"] __authors__ = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]

View File

@ -8,6 +8,7 @@ All exceptions should inherit from the common base exception :exc:`ToxPoetryInst
+-- LockedDepVersionConflictError +-- LockedDepVersionConflictError
+-- LockedDepNotFoundError +-- LockedDepNotFoundError
+-- ExtraNotFoundError +-- ExtraNotFoundError
+-- LockedDepsRequiredError
""" """

View File

@ -5,6 +5,7 @@ specifically related to implementing the hooks (to keep the size/readability of
themselves manageable). themselves manageable).
""" """
from typing import List from typing import List
from typing import Optional
from poetry.core.packages import Package as PoetryPackage from poetry.core.packages import Package as PoetryPackage
from poetry.factory import Factory as PoetryFactory from poetry.factory import Factory as PoetryFactory
@ -51,7 +52,7 @@ def tox_addoption(parser: ToxParser):
@hookimpl @hookimpl
def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction): def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional[bool]:
"""Install the dependencies for the current environment """Install the dependencies for the current environment
Loads the local Poetry environment and the corresponding lockfile then pulls the dependencies Loads the local Poetry environment and the corresponding lockfile then pulls the dependencies
@ -69,7 +70,7 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction):
reporter.verbosity1( reporter.verbosity1(
f"{constants.REPORTER_PREFIX} skipping isolated build env '{action.name}'" f"{constants.REPORTER_PREFIX} skipping isolated build env '{action.name}'"
) )
return return None
try: try:
poetry = PoetryFactory().create_poetry(venv.envconfig.config.toxinidir) poetry = PoetryFactory().create_poetry(venv.envconfig.config.toxinidir)
@ -82,7 +83,7 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction):
reporter.verbosity1( reporter.verbosity1(
f"{constants.REPORTER_PREFIX} project does not use Poetry for env management, skipping installation of locked dependencies" f"{constants.REPORTER_PREFIX} project does not use Poetry for env management, skipping installation of locked dependencies"
) )
return return None
reporter.verbosity1( reporter.verbosity1(
f"{constants.REPORTER_PREFIX} loaded project pyproject.toml from {poetry.file}" f"{constants.REPORTER_PREFIX} loaded project pyproject.toml from {poetry.file}"
@ -107,16 +108,18 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction):
reporter.verbosity1( reporter.verbosity1(
f"{constants.REPORTER_PREFIX} env specifies 'skip_install = true', skipping installation of project package" f"{constants.REPORTER_PREFIX} env specifies 'skip_install = true', skipping installation of project package"
) )
return return venv.envconfig.require_locked_deps or None
if venv.envconfig.config.skipsdist: if venv.envconfig.config.skipsdist:
reporter.verbosity1( reporter.verbosity1(
f"{constants.REPORTER_PREFIX} config specifies 'skipsdist = true', skipping installation of project package" f"{constants.REPORTER_PREFIX} config specifies 'skipsdist = true', skipping installation of project package"
) )
return return venv.envconfig.require_locked_deps or None
_install_project_dependencies(venv, poetry, package_map) _install_project_dependencies(venv, poetry, package_map)
return venv.envconfig.require_locked_deps or None
def _install_env_dependencies( def _install_env_dependencies(
venv: ToxVirtualEnv, poetry: Poetry, packages: PackageMap venv: ToxVirtualEnv, poetry: Poetry, packages: PackageMap