mirror of
https://github.com/enpaul/tox-poetry-installer.git
synced 2024-12-05 01:40:44 +00:00
Update require_poetry option to be config option rather than runtime
Add deprecation warning for future removal of runtime require_poetry option
This commit is contained in:
parent
1e04edef69
commit
c8d7009200
@ -56,6 +56,13 @@ def tox_addoption(parser: ToxParser):
|
||||
help="Require all dependencies in the environment be installed using the Poetry lockfile",
|
||||
)
|
||||
|
||||
parser.add_testenv_attribute(
|
||||
name="require_poetry",
|
||||
type="bool",
|
||||
default=False,
|
||||
help="Trigger a failure if Poetry is not available to Tox",
|
||||
)
|
||||
|
||||
parser.add_testenv_attribute(
|
||||
name="locked_deps",
|
||||
type="line-list",
|
||||
@ -75,12 +82,18 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional
|
||||
:param action: Tox action object
|
||||
"""
|
||||
|
||||
if venv.envconfig.config.option.require_poetry:
|
||||
logger.warning(
|
||||
"DEPRECATION WARNING: The '--require-poetry' runtime option is deprecated and will be "
|
||||
"removed in version 1.0.0. Please update test environments that require Poetry to "
|
||||
"set the 'require_poetry = true' option in tox.ini"
|
||||
)
|
||||
|
||||
try:
|
||||
poetry = utilities.check_preconditions(venv, action)
|
||||
except exceptions.SkipEnvironment as err:
|
||||
if (
|
||||
isinstance(err, exceptions.PoetryNotInstalledError)
|
||||
and venv.envconfig.config.option.require_poetry
|
||||
if isinstance(err, exceptions.PoetryNotInstalledError) and (
|
||||
venv.envconfig.config.option.require_poetry or venv.envconfig.require_poetry
|
||||
):
|
||||
venv.status = err.__class__.__name__
|
||||
logger.error(str(err))
|
||||
|
Loading…
Reference in New Issue
Block a user