hatch icon indicating copy to clipboard operation
hatch copied to clipboard

`hatch test` fails on paths that contains spaces

Open luxedo opened this issue 4 months ago • 2 comments

When running hatc test for the first time on a directory that contains spaces (dir with spaces) it shows the following message and don't run the tests:

$ cd my-project
$ hatch test
error: Failed to parse: `<my_home>/dir with spaces/my-project`
  Caused by: Expected end of input or `;`, found `w`
/home/amu4ca/dir with spaces

Then, the following calls to hatch test don't find the installed package in the test environment

ImportError while importing test module '<my_home>/dir with spaces/my-project/tests/test_hello.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_hello.py:5: in <module>
    import my_project
E   ModuleNotFoundError: No module named 'my_project'

It shows the same behaviour from https://github.com/pypa/hatch/issues/1739 but with different root causes. Looks like the test environments are not correctly built.

I'm running hatch in:

Versão do WSL: 2.1.5.0
Versão do kernel: 5.15.146.1-2
Versão do WSLg: 1.0.60
Versão do MSRDC: 1.2.5105
Versão do Direct3D: 1.611.1-81528511
Versão do DXCore: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Versão do Windows: 10.0.19045.4894

I can give a hand solving this with a little guidance given that I don't know this codebase yet

luxedo avatar Oct 02 '24 12:10 luxedo