-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
MNT Use a pytest-like context manager in estimator_checks.py #18418
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
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
9984bc9
some stuff that I might regret later
NicolasHug 599cd21
formatting
NicolasHug f7cf7f2
some more
NicolasHug e88d6d5
some more stuff
NicolasHug d432d81
Fixed some
NicolasHug a25a0c6
docs
NicolasHug 772cbec
fixed one
NicolasHug 6ba858a
pep8
NicolasHug c1a12be
some more
NicolasHug 9f504ab
pep8
NicolasHug c2dc215
fixed one
NicolasHug 0b3ffe0
Fixed some more
NicolasHug 240a7c0
uuuuuughhhh
NicolasHug 7a66586
Merge branch 'master' of github.com:scikit-learn/scikit-learn into cm…
NicolasHug 1f18d1a
minor renmaing
NicolasHug 3b20878
Merge branch 'master' of github.com:scikit-learn/scikit-learn into cm…
NicolasHug c414990
addressed comments
NicolasHug 832efa0
Merge branch 'master' of github.com:scikit-learn/scikit-learn into cm…
NicolasHug 9f11bf0
Added test for multiple exceptions checks
NicolasHug e57dc6e
Merge branch 'master' of github.com:scikit-learn/scikit-learn into cm…
NicolasHug cfbf84f
lower case error message
NicolasHug ddb3258
wip
NicolasHug 972887f
formatting
NicolasHug 3e37462
state -> should state
NicolasHug a9c15d5
formatting again
NicolasHug 4c55288
use raise from
NicolasHug File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
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.
Did you explore the
contextlib.contextmanager
implementation and found this to be cleaner?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.
I don't believe
@contextlib.contextmanager
allows to define the__exit__
function, which is the core of the CM for catching exceptionsThere 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.
For ref this is the
pytest
implem: https://github.com/pytest-dev/pytest/blob/master/src/_pytest/python_api.py#L702 (I kept it quite similar)