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 # Prefix all reporter messages should include to indicate that they came from this module in the
# console output. # 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 # 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}" 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: try:
if venv.envconfig.require_locked_deps and venv.envconfig.deps: if venv.envconfig.require_locked_deps and venv.envconfig.deps:
raise exceptions.LockedDepsRequiredError( raise exceptions.LockedDepsRequiredError(
@ -118,14 +123,14 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional
project_deps = utilities.find_project_deps( project_deps = utilities.find_project_deps(
packages, poetry, venv.envconfig.extras packages, poetry, venv.envconfig.extras
) )
tox.reporter.verbosity1(
f"{constants.REPORTER_PREFIX} Identified {len(project_deps)} project dependencies to install to env"
)
else: else:
project_deps = [] project_deps = []
tox.reporter.verbosity1( tox.reporter.verbosity1(
f"{constants.REPORTER_PREFIX} Skipping installation of project dependencies, env does not install project package" f"{constants.REPORTER_PREFIX} Env does not install project package, skipping"
) )
tox.reporter.verbosity1(
f"{constants.REPORTER_PREFIX} Identified {len(project_deps)} project dependencies to install to env"
)
except exceptions.ToxPoetryInstallerException as err: except exceptions.ToxPoetryInstallerException as err:
venv.status = err.__class__.__name__ venv.status = err.__class__.__name__
tox.reporter.error(f"{constants.REPORTER_PREFIX} {err}") tox.reporter.error(f"{constants.REPORTER_PREFIX} {err}")

View File

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

View File

@ -111,13 +111,13 @@ def identify_transients(
else: else:
for index, dep in enumerate(package.requires): for index, dep in enumerate(package.requires):
tox.reporter.verbosity2( 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: if dep.name not in searched:
find_deps_of_deps(dep.name) find_deps_of_deps(dep.name)
else: else:
tox.reporter.verbosity2( 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( tox.reporter.verbosity2(
f"{constants.REPORTER_PREFIX} Including {package} for installation" f"{constants.REPORTER_PREFIX} Including {package} for installation"