KEMBAR78
gh-105724: Add location information to `assert` errors by sobolevn · Pull Request #105935 · python/cpython · GitHub
Skip to content

Conversation

@sobolevn
Copy link
Member

@sobolevn sobolevn commented Jun 20, 2023

New error message for assert 1 > 2 is:

Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython/ex.py", line 1, in <module>
    assert 1 > 2
           ^^^^^
AssertionError     

I've also included test cases where assert takes multiple lines.

Copy link
Member

@markshannon markshannon left a comment

Choose a reason for hiding this comment

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

Nice. Thanks.

@markshannon
Copy link
Member

test_multiline_assert in test_compile needs to be updated, otherwise LGTM.

),
('assert 1 > 2 and 3 > 2',
[
' assert 1 > 2 and 3 > 2',
Copy link
Member

Choose a reason for hiding this comment

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

Would be nice if it was possible to show which of these has failed.

Copy link
Member

Choose a reason for hiding this comment

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

It would be. But that's for another PR, IMO.
I'll elaborate on the issue.

@sobolevn sobolevn requested a review from markshannon June 23, 2023 17:00
@markshannon markshannon merged commit bdd8ddf into python:main Aug 16, 2023
fnordahl added a commit to fnordahl/ovs that referenced this pull request Apr 8, 2024
The vlog - Python3 test makes use of output from Python
Tracebacks in its test assertion.

In Python 3.13 a line with tophat (``^``) markers is added below
Tracebacks from calls to assert [0], which makes the test fail.
This change of behavior is also backported to the Python 3.12 and
3.11 stable branches [1].

Strip lines containing one or more occurence of the ``^``
character from the output before performing the test assertions.

0: python/cpython#105935
1: python/cpython#116034
Reported-at: https://launchpad.net/bugs/2060434
Signed-off-by: Frode Nordahl <fnordahl@ubuntu.com>
ovsrobot pushed a commit to ovsrobot/ovs that referenced this pull request Apr 8, 2024
The vlog - Python3 test makes use of output from Python
Tracebacks in its test assertion.

In Python 3.13 a line with tophat (``^``) markers is added below
Tracebacks from calls to assert [0], which makes the test fail.
This change of behavior is also backported to the Python 3.12 and
3.11 stable branches [1].

Strip lines containing one or more occurence of the ``^``
character from the output before performing the test assertions.

0: python/cpython#105935
1: python/cpython#116034
Reported-at: https://launchpad.net/bugs/2060434
Signed-off-by: Frode Nordahl <fnordahl@ubuntu.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
igsilya pushed a commit to igsilya/ovs that referenced this pull request Apr 9, 2024
The vlog - Python3 test makes use of output from Python
Tracebacks in its test assertion.

In Python 3.13 a line with tophat (``^``) markers is added below
Tracebacks from calls to assert [0], which makes the test fail.
This change of behavior is also backported to the Python 3.12 and
3.11 stable branches [1].

Strip lines containing one or more occurrence of the ``^``
character from the output before performing the test assertions.

0: python/cpython#105935
1: python/cpython#116034

Reported-at: https://launchpad.net/bugs/2060434
Signed-off-by: Frode Nordahl <fnordahl@ubuntu.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
igsilya pushed a commit to igsilya/ovs that referenced this pull request Apr 9, 2024
The vlog - Python3 test makes use of output from Python
Tracebacks in its test assertion.

In Python 3.13 a line with tophat (``^``) markers is added below
Tracebacks from calls to assert [0], which makes the test fail.
This change of behavior is also backported to the Python 3.12 and
3.11 stable branches [1].

Strip lines containing one or more occurrence of the ``^``
character from the output before performing the test assertions.

0: python/cpython#105935
1: python/cpython#116034

Reported-at: https://launchpad.net/bugs/2060434
Signed-off-by: Frode Nordahl <fnordahl@ubuntu.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
igsilya pushed a commit to igsilya/ovs that referenced this pull request Apr 9, 2024
The vlog - Python3 test makes use of output from Python
Tracebacks in its test assertion.

In Python 3.13 a line with tophat (``^``) markers is added below
Tracebacks from calls to assert [0], which makes the test fail.
This change of behavior is also backported to the Python 3.12 and
3.11 stable branches [1].

Strip lines containing one or more occurrence of the ``^``
character from the output before performing the test assertions.

0: python/cpython#105935
1: python/cpython#116034

Reported-at: https://launchpad.net/bugs/2060434
Signed-off-by: Frode Nordahl <fnordahl@ubuntu.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
igsilya pushed a commit to igsilya/ovs that referenced this pull request Apr 9, 2024
The vlog - Python3 test makes use of output from Python
Tracebacks in its test assertion.

In Python 3.13 a line with tophat (``^``) markers is added below
Tracebacks from calls to assert [0], which makes the test fail.
This change of behavior is also backported to the Python 3.12 and
3.11 stable branches [1].

Strip lines containing one or more occurrence of the ``^``
character from the output before performing the test assertions.

0: python/cpython#105935
1: python/cpython#116034

Reported-at: https://launchpad.net/bugs/2060434
Signed-off-by: Frode Nordahl <fnordahl@ubuntu.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
igsilya pushed a commit to igsilya/ovs that referenced this pull request Apr 9, 2024
The vlog - Python3 test makes use of output from Python
Tracebacks in its test assertion.

In Python 3.13 a line with tophat (``^``) markers is added below
Tracebacks from calls to assert [0], which makes the test fail.
This change of behavior is also backported to the Python 3.12 and
3.11 stable branches [1].

Strip lines containing one or more occurrence of the ``^``
character from the output before performing the test assertions.

0: python/cpython#105935
1: python/cpython#116034

Reported-at: https://launchpad.net/bugs/2060434
Signed-off-by: Frode Nordahl <fnordahl@ubuntu.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
igsilya pushed a commit to igsilya/ovs that referenced this pull request Apr 9, 2024
The vlog - Python3 test makes use of output from Python
Tracebacks in its test assertion.

In Python 3.13 a line with tophat (``^``) markers is added below
Tracebacks from calls to assert [0], which makes the test fail.
This change of behavior is also backported to the Python 3.12 and
3.11 stable branches [1].

Strip lines containing one or more occurrence of the ``^``
character from the output before performing the test assertions.

0: python/cpython#105935
1: python/cpython#116034

Reported-at: https://launchpad.net/bugs/2060434
Signed-off-by: Frode Nordahl <fnordahl@ubuntu.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
roseoriorden pushed a commit to roseoriorden/ovs that referenced this pull request Jul 1, 2024
The vlog - Python3 test makes use of output from Python
Tracebacks in its test assertion.

In Python 3.13 a line with tophat (``^``) markers is added below
Tracebacks from calls to assert [0], which makes the test fail.
This change of behavior is also backported to the Python 3.12 and
3.11 stable branches [1].

Strip lines containing one or more occurrence of the ``^``
character from the output before performing the test assertions.

0: python/cpython#105935
1: python/cpython#116034

Reported-at: https://launchpad.net/bugs/2060434
Signed-off-by: Frode Nordahl <fnordahl@ubuntu.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants