Skip to content

Commit

Permalink
Merge pull request #46 from ymyzk/improve-logging
Browse files Browse the repository at this point in the history
Improve logging
  • Loading branch information
ymyzk authored Nov 21, 2020
2 parents a063112 + 109a9d6 commit d987257
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,9 @@ _Changed in 2.0_: When a list of environments to run is specified explicitly via
tox-gh-actions respects the given environments and simply runs the given environments without enforcing its configuration.

Before 2.0, tox-gh-actions was always enforcing its configuration even when a list of environments is given explicitly.

## Investigation
tox-gh-actions writes log messages using `tox.reporter`.
This is handy for understanding behavior of tox-gh-actions
and when debugging tox-gh-actions.
To see the messages, please run `tox -vv`.
30 changes: 18 additions & 12 deletions src/tox_gh_actions/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,23 @@
@hookimpl
def tox_configure(config):
# type: (Config) -> None
verbosity1("running tox-gh-actions")
if not is_running_on_actions():
verbosity1(
"tox-gh-actions won't override envlist "
"because tox is not running in GitHub Actions"
)
return
elif is_env_specified(config):
verbosity1(
"tox-gh-actions won't override envlist because "
"envlist is explicitly given via TOXENV or -e option"
)
return

verbosity2("original envconfigs: {}".format(list(config.envconfigs.keys())))
verbosity2("original envlist: {}".format(config.envlist))
verbosity2("original envlist_default: {}".format(config.envlist_default))
verbosity2("original envlist: {}".format(config.envlist))

version = get_python_version()
verbosity2("Python version: {}".format(version))
Expand All @@ -25,19 +39,11 @@ def tox_configure(config):
verbosity2("tox-gh-actions config: {}".format(gh_actions_config))

factors = get_factors(gh_actions_config, version)
envlist = get_envlist_from_factors(config.envlist, factors)
verbosity2("new envlist: {}".format(envlist))

if not is_running_on_actions():
verbosity1("tox is not running in GitHub Actions")
verbosity1("tox-gh-actions won't override envlist")
return
elif is_env_specified(config):
verbosity1("envlist is explicitly given via TOXENV or -e option")
verbosity1("tox-gh-actions won't override envlist")
return
verbosity2("using the following factors to decide envlist: {}".format(factors))

envlist = get_envlist_from_factors(config.envlist, factors)
config.envlist_default = config.envlist = envlist
verbosity1("overriding envlist with: {}".format(envlist))


@hookimpl
Expand Down

0 comments on commit d987257

Please sign in to comment.