-
Notifications
You must be signed in to change notification settings - Fork 36
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
Use FutureWarning
instead of DeprecationWarning
.
#692
Conversation
Codecov Report
@@ Coverage Diff @@
## master #692 +/- ##
=======================================
Coverage 78.54% 78.54%
=======================================
Files 65 65
Lines 7141 7141
Branches 1565 1565
=======================================
Hits 5609 5609
Misses 1228 1228
Partials 304 304
Continue to review full report at Codecov.
|
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.
Hi @Onkar627, thank you for the pull request! It looks like the changes in this PR are good, but incomplete. I have a few requests for this PR before merging - please review my comment on #691 for some basic steps needed for all pull requests (description, title, checklist),
Additionally, this PR should update a few other DeprecationWarning
s that were missed. These can be found in signac/synced_collections/backends/collection_json.py
and signac/synced_collections/buffers/file_buffered_collection.py
. I have included direct links below.
DeprecationWarning, |
DeprecationWarning, |
DeprecationWarning( |
Finally, we may need to update the warning filters in tests/test_project.py
and tests/test_job.py
. These may need to hide FutureWarning
instead of DeprecationWarning
. You can check the pytest output to see what warnings are raised.
Line 2597 in c291e1e
warnings.filterwarnings("ignore", category=DeprecationWarning, module="signac") |
Line 81 in c291e1e
warnings.filterwarnings("ignore", category=DeprecationWarning, module="signac") |
signac/common/configobj/__init__.py
Outdated
@@ -1188,7 +1188,7 @@ def __init__( | |||
warnings.warn( | |||
"Passing in an options dictionary to ConfigObj() is " | |||
"deprecated. Use **options instead.", | |||
DeprecationWarning, | |||
FutureWarning, |
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.
This file is vendored (copied from an upstream project) so we usually avoid changing it. We have control over how this object is created in the library and it's not a part of user-facing code, so I suggest reverting this change.
FutureWarning, | |
DeprecationWarning, |
Not sure what to review without a description. |
FutureWarning
instead of DeprecationWarning
.
@Onkar627 when you address the reviews could you also fill out the PR template? You can see the sections: 1) a description of your changes; 2) an explanation of why you are making these changes (the motivation); and 3) filling out the checklist. |
Yes sure, As I changed it for other pull request will do the same for this as well. |
@Onkar627 There are some tests failing. See logs here for linux-python-38. The underlying cause is that we are using a pytest feature - with pytest.deprecated_call(match="Use of.+as key is deprecated"):
+ with pytest.warns(FutureWarning, match="Use of.+as key is deprecated"): |
warnings.warn( | ||
DeprecationWarning( | ||
FutureWarning( |
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.
Hmm, something was wrong here in the old code. Can you switch this to call warnings.warn(message, FutureWarning)
instead of warnings.warn(FutureWarning(message))
? The function isn't being used correctly.
https://docs.python.org/3/library/warnings.html#warnings.warn
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.
Yeah, sure.
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.
Tests are failing,
def test_keys_non_str_valid_type(self, synced_collection, testdata):
for key in (0, None, True):
with pytest.deprecated_call(match="Use of.+as key is deprecated"):
> synced_collection[key] = testdata
E Failed: DID NOT WARN. No warnings of type (<class 'DeprecationWarning'>, <class 'PendingDeprecationWarning'>) were emitted. The list of emitted warnings is: [FutureWarning('Use of int as key is deprecated and will be removed in version 2.0.')].
So they need to be updated
Should I also change every deprecated call feature to warn like for example in
|
…() instead.. It was only used once and is no longer needed.
for more information, see https://pre-commit.ci
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.
Thanks @Onkar627! I pushed a commit to address your question about conftest.py
, that was a good observation. That function deprecated_in_version
was outdated and only used once, so I removed it. I'm going to merge this PR so that I can do some related follow-up work.
Description
Fixes issues as described by @vyasr in Issue #687 as we tend to change the DeprecationWarning to FutureWarning instead.
Motivation and Context
The main motivation of this change is basically that warnings of the deprecated features are visible to the users as in current scenarios of Deprecated warnings python hides these by default.
Types of Changes
1The change breaks (or has the potential to break) existing functionality.
Checklist:
If necessary: