Skip to content

Commit

Permalink
Merge pull request #112 from ymyzk/tox4-plugin-api-change
Browse files Browse the repository at this point in the history
Adopt breaking plugin API change in tox 4.0.0a10
  • Loading branch information
ymyzk committed Jan 8, 2022
2 parents 648acb0 + 8d731e5 commit 6aa0c18
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Expand Up @@ -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

Expand Down
13 changes: 7 additions & 6 deletions src/tox_gh_actions/plugin.py
Expand Up @@ -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(
Expand Down Expand Up @@ -209,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

Expand Down

0 comments on commit 6aa0c18

Please sign in to comment.