Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hatch test fails on paths that contains spaces #1741

Open
luxedo opened this issue Oct 2, 2024 · 2 comments
Open

hatch test fails on paths that contains spaces #1741

luxedo opened this issue Oct 2, 2024 · 2 comments

Comments

@luxedo
Copy link

luxedo commented Oct 2, 2024

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 #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
Copy link
Author

luxedo commented Oct 2, 2024

Possibly related to astral-sh/uv#7765

There's already a fix merged astral-sh/uv#7767

Anyway, it would be good to handle errors when building the test environments and give a better error message

@ofek
Copy link
Collaborator

ofek commented Oct 2, 2024

Yes I think that would be the issue!

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

No branches or pull requests

2 participants