From 37566a7223962831ebac6651b7271123614336c6 Mon Sep 17 00:00:00 2001 From: Yusuke Miyazaki Date: Sat, 8 Jan 2022 16:31:05 +0900 Subject: [PATCH 1/2] Adopt breaking plugin API change in tox 4.0.0a10 --- setup.cfg | 2 +- src/tox_gh_actions/plugin.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index d304446..bc86835 100644 --- a/setup.cfg +++ b/setup.cfg @@ -41,7 +41,7 @@ package_dir = zip_safe = True python_requires = >=3.7 install_requires = - tox >= 4.0.0a9, <5 + tox >= 4.0.0a10, <5 setup_requires = setuptools_scm[toml] >=6, <7 diff --git a/src/tox_gh_actions/plugin.py b/src/tox_gh_actions/plugin.py index 45654ce..5500169 100644 --- a/src/tox_gh_actions/plugin.py +++ b/src/tox_gh_actions/plugin.py @@ -15,13 +15,16 @@ from tox.config.types import EnvList from tox.execute.api import Outcome from tox.plugin import impl +from tox.session.state import State from tox.tox_env.api import ToxEnv logger = getLogger(__name__) @impl -def tox_add_core_config(core_conf: ConfigSet, config: Config) -> None: +def tox_add_core_config(core_conf: ConfigSet, state: State) -> None: + config = state.conf + logger.info("running tox-gh-actions") if not is_running_on_actions(): logger.warning( From 8d731e5893757d8a552a12a4e7ad83bf1b2d4305 Mon Sep 17 00:00:00 2001 From: Yusuke Miyazaki Date: Sat, 8 Jan 2022 16:48:43 +0900 Subject: [PATCH 2/2] Replace use_default_list with is_default_list --- src/tox_gh_actions/plugin.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/tox_gh_actions/plugin.py b/src/tox_gh_actions/plugin.py index 5500169..d47c61b 100644 --- a/src/tox_gh_actions/plugin.py +++ b/src/tox_gh_actions/plugin.py @@ -212,11 +212,9 @@ def is_log_grouping_enabled(options: Parsed) -> bool: def is_env_specified(config: Config) -> bool: """Returns True when environments are explicitly given""" - if os.environ.get("TOXENV"): - # When TOXENV is a non-empty string - return True - elif hasattr(config.options, "env") and not config.options.env.use_default_list: - # When command line argument (-e) is given + if hasattr(config.options, "env") and not config.options.env.is_default_list: + # is_default_list becomes False when TOXENV is a non-empty string + # and when command line argument (-e) is given. return True return False