-
Notifications
You must be signed in to change notification settings - Fork 6
deps: Updates deprecation warning to FutureWarning re: 3.7 and 3.8 #338
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
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!
with mock.patch(MOCK_EXTRACT_VERSION, return_value=mock_version_tuple), mock.patch( | ||
MOCK_WARN | ||
) as mock_warn_call: |
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'm curious if you've tried pytest.warns
context manager rather than mocking out warnings.warn? https://docs.pytest.org/en/stable/how-to/capture-warnings.html#warns
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 have used the pytest.warns context manager in several places. During troubleshooting this, we tried many, many approaches and all of them failed so we swapped out a ton of things to try and find a solution that ended up working.
- dependencies and import timing will be the death of me.
(3, 12, 0), | ||
], | ||
) | ||
def test_check_python_version_does_not_warn_on_supported(mock_version_tuple): |
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.
Maybe add a pytest.skip for older Pythons if the extra warning is causing trouble here?
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 is not a pytest issue, per se. i.e. it is not the test that triggers the problem and thus we can't mark a specific test as .skipif(sys.version <= (3, 8))
.
When we run a file such as test_arrow, line 24 is import db-dtypes
and the process of importing triggers the warning if we run under Py 3.7 and 3.8, which we definitely do in this PR cause another PR removes dependencies on Py37 and Py38.
So this is kind of a catch-22.
Revises the Python 3.7/3.8 PendingDeprecationWarning to a FutureWarning and isolates the logic into a function for easier testing.
This is in support of a larger and more complicated PR coming that will drop support for 3.7 and 3.8:
#337