[Pytest-commit] [pytest-dev/pytest] 984902: Remove "matching '...'" part from the pytest.raise...

Bruno Oliveira nicoddemus at gmail.com
Sat Feb 17 18:18:07 EST 2018


  Branch: refs/heads/master
  Home:   https://github.com/pytest-dev/pytest
  Commit: 9849022eb2421c9e468609cbbbedf63a8a042702
      https://github.com/pytest-dev/pytest/commit/9849022eb2421c9e468609cbbbedf63a8a042702
  Author: Florian Bruhin <git at the-compiler.org>
  Date:   2018-02-14 (Wed, 14 Feb 2018)

  Changed paths:
    M _pytest/python_api.py
    A changelog/3222.trivial

  Log Message:
  -----------
  Remove "matching '...'" part from the pytest.raises message

When a test with pytest.raises(ValueError, match='foo') doesn't raise, the
following error is printed:

    Failed: DID NOT RAISE <class 'ValueError'> matching 'foo'

This error message is confusing as it implies a ValueError was raised, but the
message wasn't matching 'foo'.

I first considered rewording it somehow to preserve the match pattern in it, but
I don't think that's worthwhile as the pattern should usually be apparent from
the stacktrace anyways (hard-coded, as parametrization, or with --showlocals for
more sophisticated cases).


  Commit: 3cbf0c8ec028e4fdba2e66327a2d4f01025804c4
      https://github.com/pytest-dev/pytest/commit/3cbf0c8ec028e4fdba2e66327a2d4f01025804c4
  Author: Florian Bruhin <git at the-compiler.org>
  Date:   2018-02-15 (Thu, 15 Feb 2018)

  Changed paths:
    M _pytest/python_api.py
    A changelog/3222.bugfix
    R changelog/3222.trivial
    M testing/python/raises.py

  Log Message:
  -----------
  Raise unexpected exceptions with pytest.raises() using match=


  Commit: b486e1294b9202f770c6f7481a521e55f8908dbe
      https://github.com/pytest-dev/pytest/commit/b486e1294b9202f770c6f7481a521e55f8908dbe
  Author: Bruno Oliveira <nicoddemus at gmail.com>
  Date:   2018-02-17 (Sat, 17 Feb 2018)

  Changed paths:
    M _pytest/python_api.py
    A changelog/3222.bugfix
    M testing/python/raises.py

  Log Message:
  -----------
  Merge pull request #3222 from The-Compiler/match-msg

Remove "matching '...'" part from the pytest.raises message


Compare: https://github.com/pytest-dev/pytest/compare/9d879bee360d...b486e1294b92


More information about the pytest-commit mailing list