Update logging messages to improve UX and output consistency

This commit is contained in:
Ethan Paul 2021-02-10 00:06:33 -05:00
parent 08a6962d3f
commit e894a25d18
No known key found for this signature in database
GPG Key ID: C5F5542B54A4D9C6
4 changed files with 14 additions and 9 deletions

View File

@ -19,7 +19,7 @@ PEP508_VERSION_DELIMITERS: Tuple[str, ...] = ("~=", "==", "!=", ">", "<")
# Prefix all reporter messages should include to indicate that they came from this module in the
# console output.
REPORTER_PREFIX: str = f"[{__about__.__title__}]:"
REPORTER_PREFIX: str = f"{__about__.__title__}:"
# Semver compatible version of the current python platform version. Used for checking

View File

@ -84,6 +84,11 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional
f"{constants.REPORTER_PREFIX} Loaded project pyproject.toml from {poetry.file}"
)
if not poetry.locker.is_fresh():
tox.reporter.warning(
f"The Poetry lock file is not up to date with the latest changes in {poetry.file}"
)
try:
if venv.envconfig.require_locked_deps and venv.envconfig.deps:
raise exceptions.LockedDepsRequiredError(
@ -118,13 +123,13 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional
project_deps = utilities.find_project_deps(
packages, poetry, venv.envconfig.extras
)
tox.reporter.verbosity1(
f"{constants.REPORTER_PREFIX} Identified {len(project_deps)} project dependencies to install to env"
)
else:
project_deps = []
tox.reporter.verbosity1(
f"{constants.REPORTER_PREFIX} Skipping installation of project dependencies, env does not install project package"
)
tox.reporter.verbosity1(
f"{constants.REPORTER_PREFIX} Identified {len(project_deps)} project dependencies to install to env"
f"{constants.REPORTER_PREFIX} Env does not install project package, skipping"
)
except exceptions.ToxPoetryInstallerException as err:
venv.status = err.__class__.__name__

View File

@ -42,12 +42,12 @@ def install(
for dependency in packages:
if dependency not in installed:
tox.reporter.verbosity1(
tox.reporter.verbosity2(
f"{constants.REPORTER_PREFIX} Installing {dependency}"
)
pip.install(dependency)
installed.add(dependency)
else:
tox.reporter.verbosity1(
tox.reporter.verbosity2(
f"{constants.REPORTER_PREFIX} Already installed {dependency}, skipping"
)

View File

@ -111,13 +111,13 @@ def identify_transients(
else:
for index, dep in enumerate(package.requires):
tox.reporter.verbosity2(
f"{constants.REPORTER_PREFIX} Processing dependency {index + 1}/{len(package.requires)} for {package}: {dep.name}"
f"{constants.REPORTER_PREFIX} Processing {package} dependency {index + 1}/{len(package.requires)}: {dep.name}"
)
if dep.name not in searched:
find_deps_of_deps(dep.name)
else:
tox.reporter.verbosity2(
f"{constants.REPORTER_PREFIX} Package with name '{dep.name}' has already been processed, skipping"
f"{constants.REPORTER_PREFIX} Skip {package}: already included for installation"
)
tox.reporter.verbosity2(
f"{constants.REPORTER_PREFIX} Including {package} for installation"