Skip to content

Commit

Permalink
No need for a warning when tox-gh does what it's supposed to do (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat authored Jul 25, 2023
1 parent 8407301 commit 83e33a8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/tox_gh/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def tox_add_core_config(core_conf: ConfigSet, state: State) -> None:
elif getattr(state.conf.options.env, "is_default_list", False) is False:
bail_reason = f"envlist is explicitly given via {'TOXENV'if os.environ.get('TOXENV') else '-e flag'}"
if bail_reason:
logging.warning("tox-gh won't override envlist because %s", bail_reason)
logging.debug("tox-gh won't override envlist because %s", bail_reason)
return

logging.warning("running tox-gh")
Expand Down
14 changes: 11 additions & 3 deletions tests/test_tox_gh.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,26 @@


def test_gh_not_in_actions(monkeypatch: MonkeyPatch, tox_project: ToxProjectCreator) -> None:
monkeypatch.delenv("GITHUB_ACTIONS", raising=False)
project = tox_project({"tox.ini": "[testenv]\npackage=skip"})
result = project.run("-vv")
result.assert_success()
assert "tox-gh won't override envlist because tox is not running in GitHub Actions" in result.out


def test_gh_not_in_actions_quiet(monkeypatch: MonkeyPatch, tox_project: ToxProjectCreator) -> None:
monkeypatch.delenv("GITHUB_ACTIONS", raising=False)
project = tox_project({"tox.ini": "[testenv]\npackage=skip"})
result = project.run()
result.assert_success()
assert "ROOT: tox-gh won't override envlist because tox is not running in GitHub Actions" in result.out
assert "tox-gh won't override envlist because tox is not running in GitHub Actions" not in result.out


def test_gh_e_flag_set(monkeypatch: MonkeyPatch, tox_project: ToxProjectCreator) -> None:
monkeypatch.setenv("GITHUB_ACTIONS", "true")
monkeypatch.delenv("TOXENV", raising=False)
project = tox_project({"tox.ini": "[testenv]\npackage=skip"})
result = project.run("-e", "py")
result = project.run("-e", "py", "-vv")
result.assert_success()
assert "tox-gh won't override envlist because envlist is explicitly given via -e flag" in result.out

Expand All @@ -33,7 +41,7 @@ def test_gh_toxenv_set(monkeypatch: MonkeyPatch, tox_project: ToxProjectCreator)
monkeypatch.setenv("GITHUB_ACTIONS", "true")
monkeypatch.setenv("TOXENV", "py")
project = tox_project({"tox.ini": "[testenv]\npackage=skip"})
result = project.run()
result = project.run("-vv")
result.assert_success()
assert "tox-gh won't override envlist because envlist is explicitly given via TOXENV" in result.out

Expand Down

0 comments on commit 83e33a8

Please sign in to comment.