-
-
Notifications
You must be signed in to change notification settings - Fork 610
fix: make conftest.py special with gazelle #879
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
Conversation
Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com>
@@ -0,0 +1,12 @@ | |||
import unittest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the __test__.py
file a gazelle convention that automatically becomes the test entrypoint, or is it generated? Reason I'm asking is this file name doesn't seem to match the allowed test patterns in generate, but gets included in the py_test sources.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's special for Gazelle. The following is the main logic (though they are used in some other places).
This allows the conftest.py to be used on sub-directories as pytest would pick them up. Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com>
Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com>
Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com>
Trying to upgrade from |
@ewhauser I just got one of these myself. I'm not sure yet what causes it, but if I clear the BUILD file and ask Gazelle to generate it again, it does the right thing. I'll work on a fix. |
Hi @f0rmiga. Any progress on a fix? Minimally, I feel like this feature should be documented in the top-level README. Perhaps, also add a flag to disable it if you want to handle As a future feature idea, it would be great if the generated |
conftest.py
is a special file that should be used only with tests, so we create apy_library
for it and add it as a dependency topy_test
. By special-casing it, we take advantage of all the dependency resolution Gazelle offers. In contrast, when adding it to apy_test
with# keep
and excluding it from Gazelle, we also have to manage its dependencies manually.