Skip to content

Conversation

@agoscinski
Copy link
Collaborator

Right now hatch test runs also files in top level directory, this is a bit annoying since one needs to specify hatch test -- tests. This is not really fixing it, I need to investigate this further.

@DropD
Copy link
Collaborator

DropD commented Jan 22, 2025

Right now hatch test runs also files in top level directory, this is a bit annoying since one needs to specify hatch test -- tests. This is not really fixing it, I need to investigate this further.

I never need to do that. Do you keep uncommitted test_xyz.py files in your top-level, which pytest recognizes as tests?

@agoscinski
Copy link
Collaborator Author

It runs for some reason a file called debug.py. There is also no test function in it. I dont fully understand this because I don't have this problem in other projects. This PR is more like a reminder to look at it. I dont think the change here really is a good solution.

@DropD
Copy link
Collaborator

DropD commented Jan 27, 2025

It runs for some reason a file called debug.py. There is also no test function in it. I dont fully understand this because I don't have this problem in other projects. This PR is more like a reminder to look at it. I dont think the change here really is a good solution.

It might be scanning the file for doctests. Since the file is not part of the repo I would recommend trying the following in a top-level conftest.py, which you can locally git-ignore: https://stackoverflow.com/questions/41358778/can-i-make-the-pytest-doctest-module-ignore-a-file

@agoscinski
Copy link
Collaborator Author

agoscinski commented May 6, 2025

It might be scanning the file for doctests. Since the file is not part of the repo I would recommend trying the following in a top-level conftest.py, which you can locally git-ignore: https://stackoverflow.com/questions/41358778/can-i-make-the-pytest-doctest-module-ignore-a-file

No it does not work. Also the issue does not appear if I run pytest in the hatch-shell env. Can I merge this PR?

Right now `hatch test` runs also files in top level directory. By adding
the default argument `tests`, hatch will only the tests in the test
folder.
@agoscinski agoscinski force-pushed the by-default-use-tests branch from 3ac48ef to e9d07d2 Compare May 6, 2025 05:24
@agoscinski agoscinski marked this pull request as ready for review May 6, 2025 05:24
@agoscinski agoscinski requested a review from DropD May 6, 2025 05:24
@agoscinski agoscinski changed the title WIP: By default run tests in tests folder Add tests as default arg to hatch-test May 6, 2025
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

Successfully merging this pull request may close these issues.

3 participants