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

Update pytest to 7.4.1 #96995

Closed
wants to merge 3 commits into from
Closed

Conversation

cdce8p
Copy link
Member

@cdce8p cdce8p commented Jul 21, 2023

Proposed change

https://docs.pytest.org/en/stable/changelog.html#pytest-7-3-2-2023-06-10
https://docs.pytest.org/en/stable/changelog.html#pytest-7-4-0-2023-06-23
https://docs.pytest.org/en/stable/changelog.html#pytest-7-4-1-2023-09-02

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 added the smash Indicator this PR is close to finish for merging or closing label Jul 21, 2023
@cdce8p
Copy link
Member Author

cdce8p commented Jul 21, 2023

Interesting 🤔
There seems to be a regression in pytest...

Marking as draft for now.

@cdce8p cdce8p marked this pull request as draft July 21, 2023 10:58
@cdce8p cdce8p removed the smash Indicator this PR is close to finish for merging or closing label Jul 21, 2023
@cdce8p
Copy link
Member Author

cdce8p commented Jul 22, 2023

Blocked by pytest-dev/pytest#11239

@cdce8p cdce8p added the waiting-for-upstream We're waiting for a change upstream label Jul 22, 2023
@cdce8p cdce8p changed the title Update pytest to 7.4.0 Update pytest to 7.4.1 Sep 2, 2023
@@ -3805,10 +3805,12 @@ def _check_entities() -> int:
async_fire_mqtt_message(hass, "test-topic_manual1", "manual1_intial")
async_fire_mqtt_message(hass, "test-topic_manual3", "manual3_intial")

assert (state := hass.states.get("sensor.test_manual1")) is not None
Copy link
Member

Choose a reason for hiding this comment

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

Out of curiosity, why is this changed?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is an open bug in pytest assertion rewriter. See pytest-dev/pytest#11239

Tbh I'm not sure if we should update. The intention behind 8579d5f was more to see if CI would pass (it should 🤞🏻). 7.4.0 fixed a lot of deprecation warnings which would appear in Python 3.12. What do you think, should we update now even if := in asserts don't work?

Copy link
Member

Choose a reason for hiding this comment

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

Are these the only places where assertions are used using the walrus? I don't think they're that many tbh

Without the walrus the test is better to read imo

Copy link
Member Author

Choose a reason for hiding this comment

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

Are these the only places where assertions are used using the walrus? I don't think they're that many tbh

AFAIC yes. At least those two files are the only ones with errors during the last CI run.
https://github.com/home-assistant/core/actions/runs/6060843262

What's difficult IMO is that the test case using := is normally fine. It's actually an unrelated test case in the same test file that breaks which just happens to use the same name (state in this case) in an assert. This should really be fixed in pytest.

Without the walrus the test is better to read imo

It depends. I'm probably +0 on this. Somethings can I see the appeal of using assignment expressions.

Copy link
Member Author

Choose a reason for hiding this comment

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

Opened a PR upstream to fix it: pytest-dev/pytest#11414

@cdce8p cdce8p mentioned this pull request Oct 24, 2023
20 tasks
@cdce8p
Copy link
Member Author

cdce8p commented Oct 24, 2023

Closed in favor of #102744

@cdce8p cdce8p closed this Oct 24, 2023
@cdce8p cdce8p deleted the update-pytest branch October 24, 2023 23:34
@github-actions github-actions bot locked and limited conversation to collaborators Oct 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed dependency dependency-bump small-pr PRs with less than 30 lines. waiting-for-upstream We're waiting for a change upstream
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants