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
Revert #10603 so that conftest.py
belongs to python_tests
again
#10619
Revert #10603 so that conftest.py
belongs to python_tests
again
#10619
Conversation
…an `python_tests` (pantsbuild#10603)" This reverts commit 255f9e0. [ci skip-rust] [ci skip-build-wheels]
…s` again # Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
I still need to add a PR description, but wanted to get this up before I have to leave for the next 2 hours. |
@@ -275,16 +278,12 @@ async def run_python_test( | |||
|
|||
|
|||
@rule(desc="Run Pytest in an interactive process") | |||
async def debug_python_test(test_setup: TestTargetSetup) -> TestDebugRequest: | |||
def debug_python_test(setup: TestTargetSetup) -> TestDebugRequest: |
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.
async?
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.
No need for async if there are no await
s in the rule.
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.
Feels like a gotcha, if someone adds await
they will have to notice this and add async
. Although that's just a normal demand of asyncio, so maybe it's fine.
Yeah, it's fine.
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
PR description added. |
…und2 [ci skip-rust] [ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
@@ -275,16 +278,12 @@ async def run_python_test( | |||
|
|||
|
|||
@rule(desc="Run Pytest in an interactive process") | |||
async def debug_python_test(test_setup: TestTargetSetup) -> TestDebugRequest: | |||
def debug_python_test(setup: TestTargetSetup) -> TestDebugRequest: |
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.
Feels like a gotcha, if someone adds await
they will have to notice this and add async
. Although that's just a normal demand of asyncio, so maybe it's fine.
Yeah, it's fine.
This allows us to output the original exit code to the user, which is helpful because Pytest codes are significant. This PR also fixes an issue with `test --debug` unintentionally running on `conftest.py` files. Per #10619, we special case that file to skip it. [ci skip-rust] [ci skip-build-wheels]
In #10603, we moved
conftest.py
frompython_tests
topython_library
. This is because Pants now runs file-at-a-time for Pytest thanks to the model change in #10511. This causesconftest.py
to error because it doesn't have any test files.We decided in #10603 that
conftest.py
should be underpython_library
because it is not actual tests. For example, test util code goes under apython_library
target already.However,
python_library
owning aconftest.py
by default ended up being problematic, as it caused test code to be mixed with production code, which is generally not desired. See #10613 for an approach to fix this.Instead of adding a
conftest
target, this PR instead moves backconftest.py
topython_tests
and special casespytest_runner.py
to skipconftest.py
. Even though this is less correct, it's simpler for users and it avoids making 1.x users having to change a bunch of things. Conceptually,conftest.py
can be seen as "config" for tests, rather than traditional "test utils" like you'd have in apython_library
.[ci skip-rust]