hatch
hatch copied to clipboard
Make `hatch -e hatch-test.py3.11 test …` work as expected
Hatch’s global env selection via -e shouldn’t be ignored by hatch test.
This is useful because hatch env show -i --json only outputs env names and not the necessary hatch test env selection syntax. So to derive e.g. a GitHub test matrix fully from Hatch’s CLI, currently only hatch run syntax can be used, which leads to ugly workflows:
- name: Run tests with coverage
env:
COVERAGE_PROCESS_START: ${{ github.workspace }}/pyproject.toml
run: |
uvx hatch run ${{ matrix.env.name }}:run-cov -v --color=yes -n auto
uvx hatch run ${{ matrix.env.name }}:cov-combine
uvx hatch run ${{ matrix.env.name }}:coverage xml
cc @ilan-gold @grst
Oooh, actually since coverage 7.10, the new [run] patch config makes this pretty easy, we should switch to that instead! See https://github.com/nedbat/coveragepy/commit/6d2e56209ebe3bb2595e8b180c99845c25576d53
Oh, that's awesome!