pypa / hatch

Modern, extensible Python project management
https://hatch.pypa.io/latest/
MIT License
6.11k stars 309 forks source link

test run with `hatch test` fails for lack of dependency that is included in `pyproject.toml` #1823

Open ajprax opened 5 days ago

ajprax commented 5 days ago

I'm working on a library that includes some optional dependencies. At test time, these dependencies are required to test the optional code.

I have the dependencies included in pyproject.toml thusly:

[tool.hatch.envs.test]
dependencies = ["crcmod", "tqdm", "watchdog"]

(crcmod and tqdm are optional dependencies of the library, watchdog is used in a simple test watcher)

If I run hatch env show I see the dependencies properly included in the test environment, and when I run hatch -e test run python I can import them, but when I run hatch test they fail with an import error.

To add further confusion, tqdm works properly, while crcmod (and numpy from further testing on another branch) both fail to import during tests. tqdm was the first added, but I haven't been able to find any other differences between how it and the others were added.

This branch has the issue.