Skip to content

Conversation

jwatson0
Copy link

@jwatson0 jwatson0 commented Oct 9, 2025

Fixes IndexError crash in "hatch test -py 3.14 --cover"

Before this PR:

$ hatch test -py 3.14 --cover
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/jwatson/.pyenv/versions/3.14.0/lib/python3.14/site-packages/hatch/cli/__init__.py:221 in   │
│ main                                                                                             │
│                                                                                                  │
│   218                                                                                            │
│   219 def main():  # no cov                                                                      │
│   220 │   try:                                                                                   │
│ ❱ 221 │   │   hatch(prog_name='hatch', windows_expand_args=False)                                │
│   222 │   except Exception:  # noqa: BLE001                                                      │
│   223 │   │   import sys                                                                         │
│   224                                                                                            │
│                                                                                                  │
│ /home/jwatson/.pyenv/versions/3.14.0/lib/python3.14/site-packages/click/core.py:1462 in __call__ │
│                                                                                                  │
│ /home/jwatson/.pyenv/versions/3.14.0/lib/python3.14/site-packages/click/core.py:1383 in main     │
│                                                                                                  │
│ /home/jwatson/.pyenv/versions/3.14.0/lib/python3.14/site-packages/click/core.py:1850 in invoke   │
│                                                                                                  │
│ /home/jwatson/.pyenv/versions/3.14.0/lib/python3.14/site-packages/click/core.py:1246 in invoke   │
│                                                                                                  │
│ /home/jwatson/.pyenv/versions/3.14.0/lib/python3.14/site-packages/click/core.py:814 in invoke    │
│                                                                                                  │
│ /home/jwatson/.pyenv/versions/3.14.0/lib/python3.14/site-packages/click/decorators.py:34 in      │
│ new_func                                                                                         │
│                                                                                                  │
│ /home/jwatson/.pyenv/versions/3.14.0/lib/python3.14/site-packages/hatch/cli/test/__init__.py:199 │
│ in test                                                                                          │
│                                                                                                  │
│   196 │   │   │   context.env_vars['COVERAGE_PROCESS_START'] = coverage_config_file              │
│   197 │                                                                                          │
│   198 │   if cover:                                                                              │
│ ❱ 199 │   │   for context in app.runner_context([selected_envs[0]]):                             │
│   200 │   │   │   context.add_shell_command('cov-combine')                                       │
│   201 │   │                                                                                      │
│   202 │   │   if not cover_quiet:                                                                │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
IndexError: list index out of range

Fixes IndexError crash in "hatch test -py 3.14 --cover"
@cjames23
Copy link
Contributor

cjames23 commented Oct 9, 2025

Can you adjust tests/cli/env/test_show.py for test_default_as_json test as well for this change?

@flying-sheep
Copy link
Contributor

jwatson0#1

@jwatson0
Copy link
Author

Applied changes from commit 0636e7b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants