Skip to content
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

Filter some pytest warnings #98689

Merged
merged 4 commits into from Aug 20, 2023
Merged

Filter some pytest warnings #98689

merged 4 commits into from Aug 20, 2023

Conversation

cdce8p
Copy link
Member

@cdce8p cdce8p commented Aug 19, 2023

Proposed change

Ignore unhelpful warnings to make it easier to spot the important ones.

The current pytest warnings overview is quite cluttered with a lot of DeprecationWarnings. In most cases we can't even do anything about it or they are already tracked upstream. There is no need for us to keep them around in our pytest output. Nobody is going to read 100+ entries just to find the one we can / should actually fix. As example, the logs from a recent Actions run on dev: https://github.com/home-assistant/core/suites/15266074255/artifacts/872069112

All pytest logs can be downloaded via the pytest-<run_no> artifact from the run summary view.

I've added warnings filter for the following categories:

  • The warning is a result of a specific design choice. I.e. unavoidable unless wrapped with warnings.catch_warnings.
    https://docs.python.org/3/library/warnings.html#temporarily-suppressing-warnings
  • The warning is tracked upstream either in an issue or a PR
  • A fix has already been merged upstream but either there hasn't been a new release or the pinned version hasn't been updated yet. The later should ideally be rather soon but that might not always be possible to do quickly.
  • Warnings emitted on code from unmaintained projects. Last release roughly 2 or more years ago.
    Those might still be fixed but there is no telling when and it would likely be wasted time to try and fix them.

Whenever possible I tried to be as precise as possible when adding a new entry. For example almost all filters are only applied to specific modules.

I've also added comments for each entry to make it easier to check if these are still needed in the future.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@cdce8p cdce8p requested a review from a team as a code owner August 19, 2023 22:11
@home-assistant home-assistant bot added cla-signed small-pr PRs with less than 30 lines. labels Aug 19, 2023
pyproject.toml Outdated
"ignore:module '(sre_parse|sre_constants)' is deprecate:DeprecationWarning:lark.utils",
# https://pypi.org/project/lomond/ - v0.3.3 - 2018-09-21
"ignore:ssl.PROTOCOL_TLS is deprecated:DeprecationWarning:lomond.session",
# https://pypi.org/project/paho-mqtt/ - v1.6.1 - 2021-10-21
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope paho-mqtt isn't unmaintained. It's a corner stone for many things MQTT.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope so too but at the moment it isn't looking good. The last commit was 7 months ago. I can remove the entry here if you like.
https://github.com/eclipse/paho.mqtt.python

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look good. Found this post on the mailing list: https://www.eclipse.org/lists/paho-dev/msg04742.html
Anyway, the deprecation is also tracked upstream, so moved the entry to the another section.

Copy link
Member

@janiversen janiversen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A really helpful PR, thanks.

Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@cdce8p cdce8p merged commit 4c36408 into home-assistant:dev Aug 20, 2023
34 checks passed
@cdce8p cdce8p deleted the ignore-warnings branch August 20, 2023 16:30
@github-actions github-actions bot locked and limited conversation to collaborators Aug 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed small-pr PRs with less than 30 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants