Skip to content

Commit 4c81528

Browse files
fix(hooks): handle runners that bypass tox_on_install hook (#222)
1 parent 647c3dc commit 4c81528

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/tox_gh/plugin.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,12 @@ def tox_before_run_commands(tox_env: ToxEnv) -> None:
122122
:param tox_env: the tox environment
123123
"""
124124
if tox_env.core["is_on_gh_action"]:
125-
assert _STATE.installing # noqa: S101
126-
_STATE.installing = False
127-
print("::endgroup::") # noqa: T201
125+
# Check if we're coming from an install phase (defensive check for lock-based runners)
126+
if getattr(_STATE, "installing", False):
127+
# Traditional path: close the install group that was opened in tox_on_install
128+
_STATE.installing = False
129+
print("::endgroup::") # noqa: T201
130+
# Always open the test execution group
128131
print(f"::group::tox:{tox_env.name}") # noqa: T201
129132

130133

0 commit comments

Comments
 (0)