-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
🧪 Make pytest notify us about future warnings #15620
base: devel
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1096,7 +1096,11 @@ def create_temporary_fifo(data): | |||||||||||||
path = os.path.join(tempfile.mkdtemp(), next(tempfile._get_candidate_names())) | ||||||||||||||
os.mkfifo(path, stat.S_IRUSR | stat.S_IWUSR) | ||||||||||||||
|
||||||||||||||
threading.Thread(target=lambda p, d: open(p, 'wb').write(d), args=(path, data)).start() | ||||||||||||||
def tmp_write(path, data): | ||||||||||||||
with open(path, 'wb') as f: | ||||||||||||||
f.write(data) | ||||||||||||||
|
||||||||||||||
threading.Thread(target=tmp_write, args=(path, data)).start() | ||||||||||||||
Comment on lines
+1099
to
+1103
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AlanCoding another example of #15620 (comment):
Suggested change
This is one of the reasons I didn't really want to include fixing things into the scope of the PR, since a good solution might need to be iterated on, which may make the scope grow indefinitely. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's fine with me. I suspected There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't exactly expect you to merge it. I could have changed the base after your PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AlanCoding Ah, I was under the impression that you wanted it to be a part of the PR before merging. Anyway, it's not really blocking, I just wanted to be explicit about my observations. I think I'll add these code suggestions on top and then wait until somebody hits merge, then. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or maybe not… This import isn't there, and I won't be doing this from browser. Let's leave it as is and document somewhere that it's nice to address it. |
||||||||||||||
return path | ||||||||||||||
|
||||||||||||||
|
||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,4 +44,8 @@ max-line-length = 120 | |
|
||
[pytest] | ||
addopts = -v --tb=native | ||
|
||
filterwarnings = | ||
error | ||
|
||
junit_family=xunit2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,75 @@ markers = | |
job_runtime_vars: | ||
fixture_args: | ||
|
||
filterwarnings = | ||
error | ||
|
||
# FIXME: Delete this entry once `USE_L10N` use is removed. | ||
once:The USE_L10N setting is deprecated. Starting with Django 5.0, localized formatting of data will always be enabled. For example Django will display numbers and dates using the format of the current locale.:django.utils.deprecation.RemovedInDjango50Warning:django.conf | ||
|
||
# FIXME: Delete this entry once `pyparsing` is updated. | ||
once:module 'sre_constants' is deprecated:DeprecationWarning:_pytest.assertion.rewrite | ||
|
||
# FIXME: Delete this entry once `polymorphic` is updated. | ||
once:pkg_resources is deprecated as an API. See https.//setuptools.pypa.io/en/latest/pkg_resources.html:DeprecationWarning:_pytest.assertion.rewrite | ||
|
||
# FIXME: Delete this entry once `zope` is updated. | ||
once:Deprecated call to `pkg_resources.declare_namespace.'zope'.`.\nImplementing implicit namespace packages .as specified in PEP 420. is preferred to `pkg_resources.declare_namespace`. See https.//setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages:DeprecationWarning: | ||
|
||
# FIXME: Delete this entry once `coreapi` is updated. | ||
once:'cgi' is deprecated and slated for removal in Python 3.13:DeprecationWarning:_pytest.assertion.rewrite | ||
|
||
# FIXME: Delete this entry once the use of `distutils` is exterminated from the repo. | ||
once:The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives:DeprecationWarning:_pytest.assertion.rewrite | ||
|
||
# FIXME: Delete this entry once `coreapi` is deleted from the dependencies | ||
# FIXME: and is no longer imported at runtime. | ||
once:CoreAPI compatibility is deprecated and will be removed in DRF 3.17:rest_framework.RemovedInDRF317Warning:rest_framework.schemas.coreapi | ||
|
||
# FIXME: Delete this entry once naive dates aren't passed to DB lookup | ||
# FIXME: methods. Not sure where, might be in awx's views or in DAB. | ||
once:DateTimeField User.date_joined received a naive datetime .2020-01-01 00.00.00. while time zone support is active.:RuntimeWarning:django.db.models.fields | ||
|
||
# FIXME: Delete this entry once the deprecation is acted upon. | ||
once:'index_together' is deprecated. Use 'Meta.indexes' in 'main.\w+' instead.:django.utils.deprecation.RemovedInDjango51Warning:django.db.models.options | ||
|
||
# FIXME: Update `awx.main.migrations._dab_rbac` and delete this entry. | ||
# once:Using QuerySet.iterator.. after prefetch_related.. without specifying chunk_size is deprecated.:django.utils.deprecation.RemovedInDjango50Warning:django.db.models.query | ||
once:Using QuerySet.iterator.. after prefetch_related.. without specifying chunk_size is deprecated.:django.utils.deprecation.RemovedInDjango50Warning:awx.main.migrations._dab_rbac | ||
|
||
# FIXME: Delete this entry once the **broken** always-true assertions in the | ||
# FIXME: following tests are fixed: | ||
# * `awx/main/tests/unit/utils/test_common.py::TestHostnameRegexValidator::test_good_call` | ||
# * `awx/main/tests/unit/utils/test_common.py::TestHostnameRegexValidator::test_bad_call_with_inverse` | ||
once:assertion is always true, perhaps remove parentheses\?:pytest.PytestAssertRewriteWarning: | ||
|
||
# FIXME: Figure this out, fix and then delete the entry. It's not entirely | ||
# FIXME: clear what emits it and where. | ||
once:Pagination may yield inconsistent results with an unordered object_list. .class 'awx.main.models.workflow.WorkflowJobTemplateNode'. QuerySet.:django.core.paginator.UnorderedObjectListWarning:django.core.paginator | ||
|
||
# FIXME: Figure this out, fix and then delete the entry. | ||
once::django.core.paginator.UnorderedObjectListWarning:rest_framework.pagination | ||
|
||
# FIXME: Replace use of `distro.linux_distribution()` via a context manager | ||
# FIXME: in `awx/main/analytics/collectors.py` and then delete the entry. | ||
once:distro.linux_distribution.. is deprecated. It should only be used as a compatibility shim with Python's platform.linux_distribution... Please use distro.id.., distro.version.. and distro.name.. instead.:DeprecationWarning:awx.main.analytics.collectors | ||
|
||
# FIXME: Figure this out, fix and then delete the entry. | ||
once:\nUsing ProtocolTypeRouter without an explicit "http" key is deprecated.\nGiven that you have not passed the "http" you likely should use Django's\nget_asgi_application...:DeprecationWarning:awx.main.routing | ||
|
||
# FIXME: Figure this out, fix and then delete the entry. | ||
once:Channel's inbuilt http protocol AsgiHandler is deprecated. Use Django's get_asgi_application.. instead.:DeprecationWarning:channels.routing | ||
|
||
# FIXME: Use `codecs.open()` via a context manager | ||
# FIXME: in `awx/main/utils/ansible.py` to close hanging file descriptors | ||
# FIXME: and then delete the entry. | ||
once:unclosed file <_io.BufferedReader name='[^']+'>:ResourceWarning:awx.main.utils.ansible | ||
|
||
# FIXME: Use `open()` via a context manager | ||
# FIXME: in `awx/main/tests/unit/test_tasks.py` to close hanging file | ||
# FIXME: descriptors and then delete the entry. | ||
once:unclosed file <_io.TextIOWrapper name='[^']+' mode='r' encoding='UTF-8'>:ResourceWarning:awx.main.tests.unit.test_tasks | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so this line can be removed with @AlanCoding 's commit? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fosterseth I think he removed one entry already, I'm not sure about others. There were several different warnings in some files. Somebody needs to check it. |
||
|
||
# https://docs.pytest.org/en/stable/usage.html#creating-junitxml-format-files | ||
junit_duration_report = call | ||
# xunit1 contains more metadata than xunit2 so it's better for CI UIs: | ||
|
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.
@AlanCoding here's an example of what I meant @ #15620 (comment)