Revert #10603 so that conftest.py belongs to python_tests again#10619
Merged
Eric-Arellano merged 5 commits intopantsbuild:masterfrom Aug 15, 2020
Merged
Revert #10603 so that conftest.py belongs to python_tests again#10619Eric-Arellano merged 5 commits intopantsbuild:masterfrom
conftest.py belongs to python_tests again#10619Eric-Arellano merged 5 commits intopantsbuild:masterfrom
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]
Contributor
Author
|
I still need to add a PR description, but wanted to get this up before I have to leave for the next 2 hours. |
benjyw
reviewed
Aug 15, 2020
|
|
||
| @rule(desc="Run Pytest in an interactive process") | ||
| async def debug_python_test(test_setup: TestTargetSetup) -> TestDebugRequest: | ||
| def debug_python_test(setup: TestTargetSetup) -> TestDebugRequest: |
Contributor
Author
There was a problem hiding this comment.
No need for async if there are no awaits in the rule.
Contributor
There was a problem hiding this comment.
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]
Contributor
Author
|
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]
benjyw
approved these changes
Aug 15, 2020
|
|
||
| @rule(desc="Run Pytest in an interactive process") | ||
| async def debug_python_test(test_setup: TestTargetSetup) -> TestDebugRequest: | ||
| def debug_python_test(setup: TestTargetSetup) -> TestDebugRequest: |
Contributor
There was a problem hiding this comment.
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.
Eric-Arellano
added a commit
that referenced
this pull request
Aug 17, 2020
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]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #10603, we moved
conftest.pyfrompython_teststopython_library. This is because Pants now runs file-at-a-time for Pytest thanks to the model change in #10511. This causesconftest.pyto error because it doesn't have any test files.We decided in #10603 that
conftest.pyshould be underpython_librarybecause it is not actual tests. For example, test util code goes under apython_librarytarget already.However,
python_libraryowning aconftest.pyby 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
conftesttarget, this PR instead moves backconftest.pytopython_testsand special casespytest_runner.pyto 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.pycan be seen as "config" for tests, rather than traditional "test utils" like you'd have in apython_library.[ci skip-rust]