hatch icon indicating copy to clipboard operation
hatch copied to clipboard

`hatch test` not updating with new dependencies

Open lizcconrad opened this issue 1 month ago • 1 comments

I posted about this on stack overflow here; it's possible it's not an bug but a matter of me misunderstanding configuration, in which case feel free to close this.

Issue

The root of the issue is that I added a new dependency (pytest-cases) to the tests environment in pyproject.toml but it's not being recognized as a plugin when I run hatch test.

Current Behavior

When I run hatch test I see this at the start of the test session:

=============================================== test session starts ================================================
platform darwin -- Python 3.13.1, pytest-8.3.5, pluggy-1.5.0 -- /Users/username/Library/Application Support/hatch/env/virtual/pogg/ycq7iGLa/hatch-test.py3.13/bin/python3
cachedir: .pytest_cache
rootdir: /Users/username/Documents/project
configfile: pyproject.toml
plugins: rerunfailures-14.0, mock-3.14.0, xdist-3.6.1

pytest-cases is not shown in the plugins list.

However, if I run coverage run -m pytest tests directly it shows up as cases-3.9.1:

=============================================== test session starts ================================================
platform darwin -- Python 3.13.1, pytest-8.4.2, pluggy-1.6.0
Using --randomly-seed=1058354217
rootdir: /Users/username/Documents/project
configfile: pyproject.toml
plugins: randomly-3.16.0, mock-3.15.1, cases-3.9.1, xdist-3.8.0, rerunfailures-14.0

If I uninstall the package from the environment and restart the hatch shell it will say "syncing dependencies..." and install it, so it is successfully installing it per my pyproject.toml, but for some reason the hatch test command doesn't seem to reflect this change.

lizcconrad avatar Oct 30 '25 23:10 lizcconrad

Show config?

ofek avatar Oct 30 '25 23:10 ofek