Skip to content

Conversation

polkapolka
Copy link
Contributor

No description provided.

Copy link
Member

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

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

👋 Hi Phebe! This looks good to me overall - three things to do:

  1. Moving the exception definition, as below
  2. Doing the various TODOs in comments
  3. Edit the top comment to link to the issue for awareness and auto-closing, and briefly describe the issue.
@nicoddemus
Copy link
Member

Hi folks,

Sorry why is this being done? Is there an issue related to it?

@Zac-HD
Copy link
Member

Zac-HD commented May 22, 2024

Suggested in #11372 🙂

(and we're at the PyCon US sprints, so most communication about this has been verbal instead of online)

@nicoddemus
Copy link
Member

Ahh OK, no worries, thanks @Zac-HD!

If possible it helps adding the issue number in the PR description for context. 👍

@jakkdl jakkdl linked an issue Oct 23, 2024 that may be closed by this pull request
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Oct 25, 2024
@jakkdl
Copy link
Member

jakkdl commented Oct 25, 2024

Did an overhaul of the implementation, I don't think creating exceptions in _pytest.config.exceptions is the best way of doing this, it seems more in line with other stuff to do fail(msg, pytrace=False) instead. The TODOs in unittest.py are not applicable for this PR, since they were testing stuff with async plugin installed.
test_function_return_not_none_warning weren't actually testing if a warning was raised... but it now checks for fail outcome.

I also implemented ReturnNotNone, because it felt minimal and similar enough to just get done. Couldn't find an issue to link the newsfragment to though so I just pointed it to this PR.

codecov seems somewhat confused, but afaict everything is actually fine.

@jakkdl jakkdl changed the title changed warning raised by async def to error make async tests and tests that return non-None fail instead of warn Oct 25, 2024
@jakkdl jakkdl requested review from Zac-HD and graingert October 25, 2024 13:07
Copy link
Member

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

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

Thanks @polkapolka and @jakkdl for your work on this! I'm looking forward to using it myself 😁

@Zac-HD Zac-HD merged commit 5d3a3ac into pytest-dev:main Oct 25, 2024
29 checks passed
nicoddemus added a commit that referenced this pull request Nov 6, 2024
nicoddemus added a commit that referenced this pull request Nov 6, 2024
jakkdl pushed a commit to jakkdl/pytest that referenced this pull request Nov 11, 2024
Glyphack pushed a commit to Glyphack/pytest that referenced this pull request Nov 23, 2024
@n-takumasa n-takumasa mentioned this pull request Jun 13, 2025
2 tasks
sai-rekhawar pushed a commit to sai-rekhawar/cloe-nessy-py that referenced this pull request Jul 1, 2025
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [pytest](https://github.com/pytest-dev/pytest) ([changelog](https://docs.pytest.org/en/stable/changelog.html)) | dependency-groups | major | `<8.0.0,>=7.4.4` -> `<8.5.0,>=8.4.0` | --- ### Release Notes <details> <summary>pytest-dev/pytest (pytest)</summary> ### [`v8.4.0`](https://github.com/pytest-dev/pytest/releases/tag/8.4.0) [Compare Source](pytest-dev/pytest@8.3.5...8.4.0) ### pytest 8.4.0 (2025-06-02) #### Removals and backward incompatible breaking changes - [#&#8203;11372](pytest-dev/pytest#11372): Async tests will now fail, instead of warning+skipping, if you don't have any suitable plugin installed. - [#&#8203;12346](pytest-dev/pytest#12346): Tests will now fail, instead of raising a warning, if they return any value other than None. - [#&#8203;12874](pytest-dev/pytest#12874): We dropped support for Python 3.8 following its end of life (2024-10-07). - [#&#8203;12960](pytest-dev/pytest#12960): Test functions containing a yield now cause an explicit error. They have not been run since pytest 4.0, and were previously marked as an expected failure and deprecation warning. See `the docs <yield tests deprecated>`{.interpreted-text role="ref"} for more information. #### Deprecations (removal in next major release) - [#&#8203;10839](pytest-dev/pytest#10839): Requesting an asynchronous fixture without a \[pytest_fixture_setup]{.title-ref} hook that resolves it will now give a DeprecationWarning. This most commonly happens if a sync test requests an async fixture. This should have no effect on a majority of users with async tests or fixtures using async pytest plugins, but may affect non-standard hook setups or `autouse=True`. For guidance on how to work around this warning see `sync-test-async-fixture`{.interpreted-text role="ref"}. #### New features - [#&#8203;11538](pytest-dev/pytest#11538): Added `pytest.RaisesGroup`{.interpreted-text role="class"} as an equivalent to `pytest.raises`{.interpreted-text role="func"} for expecting `ExceptionGroup`{.interpreted-text role="exc"}. Also adds `pytest.RaisesExc`{.interpreted-text role="class"} which is now the logic behind `pytest.raises`{.interpreted-text role="func"} and used as parameter to `pytest.RaisesGroup`{.interpreted-text role="class"}. `RaisesGroup` includes the ability to specify multiple different expected exceptions, the structure of nested exception groups, and flags for emulating `except* <except_star>`{.interpreted-text role="ref"}. See `assert-matching-exception-groups`{.interpreted-text role="ref"} and docstrings for more information. - [#&#8203;12081](pytest-dev/pytest#12081): Added `capteesys`{.interpreted-text role="fixture"} to capture AND pass...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

5 participants