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

test_install tests are failing on Fedora build #74

Open
QuLogic opened this issue Dec 4, 2023 · 11 comments
Open

test_install tests are failing on Fedora build #74

QuLogic opened this issue Dec 4, 2023 · 11 comments

Comments

@QuLogic
Copy link
Contributor

QuLogic commented Dec 4, 2023

I'm not really sure why this is happening for me only, and not on CI, but all of test_install are failing except for protocol=None. This is during the build of tblib for Fedora, and it occurs on all releases (so Python 3.11 and 3.12). The failures are all similar to the following:

____________________________ test_install[class-5] _____________________________
tests/test_pickle_exception.py:91: in test_install
    assert expected_format_exception == ''.join(format_exception(type(exc), exc, exc.__traceback__))
E   assert 'Traceback (most recent call last):\n  File "/builddir/build/BUILD/tblib-3.0.0/tests/test_pickle_exception.py", line 43, in test_install\n    1 / 0  # noqa: B018\n    ~~^~~\nZeroDivisionError: division by zero\n\nDuring handling of the above e
xception, another exception occurred:\n\nTraceback (most recent call last):\n  File "/builddir/build/BUILD/tblib-3.0.0/tests/test_pickle_exception.py", line 46, in test_install\n    raise ValueError(\'blah\')\nValueError: blah\n\nThe above exception was
the direct cause of the following exception:\n\nTraceback (most recent call last):\n  File "/builddir/build/BUILD/tblib-3.0.0/tests/test_pickle_exception.py", line 55, in test_install\n    raise new_e from e\ntest_pickle_exception.CustomError: foo\nnote
1\nnote 2\n' == 'Traceback (most recent call last):\n  File "/builddir/build/BUILD/tblib-3.0.0/tests/test_pickle_exception.py", line 43, in test_install\n    1 / 0  # noqa: B018\n    ^^^^^^^^^^^^^^^^^\nZeroDivisionError: division by zero\n\nDuring handli
ng of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File "/builddir/build/BUILD/tblib-3.0.0/tests/test_pickle_exception.py", line 46, in test_install\n    raise ValueError(\'blah\')\n    ^^^^^^^^^^^^^^^^^\nValu
eError: blah\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n  File "/builddir/build/BUILD/tblib-3.0.0/tests/test_pickle_exception.py", line 55, in test_install\n    raise new_e from e\n    ^
^^^^^^^^^^^^^^^^\ntest_pickle_exception.CustomError: foo\nnote 1\nnote 2\n'
E       Traceback (most recent call last):
E         File "/builddir/build/BUILD/tblib-3.0.0/tests/test_pickle_exception.py", line 43, in test_install
E           1 / 0  # noqa: B018
E     -     ^^^^^^^^^^^^^^^^^
E     +     ~~^~~
E       ZeroDivisionError: division by zero
E
E       During handling of the above exception, another exception occurred:
E
E       Traceback (most recent call last):
E         File "/builddir/build/BUILD/tblib-3.0.0/tests/test_pickle_exception.py", line 46, in test_install
E           raise ValueError('blah')
E     -     ^^^^^^^^^^^^^^^^^
E       ValueError: blah
E
E       The above exception was the direct cause of the following exception:
E
E       Traceback (most recent call last):
E         File "/builddir/build/BUILD/tblib-3.0.0/tests/test_pickle_exception.py", line 55, in test_install
E           raise new_e from e
E     -     ^^^^^^^^^^^^^^^^^
E       test_pickle_exception.CustomError: foo
E       note 1
E       note 2
----------------------------- Captured stdout call -----------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/tblib-3.0.0/tests/test_pickle_exception.py", line 43, in test_install
    1 / 0  # noqa: B018
    ~~^~~
ZeroDivisionError: division by zero
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/builddir/build/BUILD/tblib-3.0.0/tests/test_pickle_exception.py", line 46, in test_install
    raise ValueError('blah')
ValueError: blah
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/builddir/build/BUILD/tblib-3.0.0/tests/test_pickle_exception.py", line 55, in test_install
    raise new_e from e
test_pickle_exception.CustomError: foo
note 1
note 2

It appears that the exact location of the error was lost in the pickled traceback, so all the carets don't appear correctly. I wonder if this is somehow related to the tblib not saving/restoring the tb_lasti attribute?

Fedora 37 & 38 are Python 3.11, and Fedora 39 and Rawhide are Python 3.12. Pytest versions vary, if that matters, starting from 7.4.3 in Rawhide down to 7.1.3 in F37.

@QuLogic QuLogic changed the title test_install tests are failing test_install tests are failing on Fedora build Dec 4, 2023
@PureTryOut
Copy link

PureTryOut commented Dec 8, 2023

I can reproduce the problem on Alpine Linux edge using Python 3.11, so at least not Fedora specific.

@ionelmc
Copy link
Owner

ionelmc commented Dec 13, 2023

tblib doesn't support those precise error locations (PEP 657), not yet. This test doesn't fail locally for me most likely because a bug in python (the test is really complex). What patch versions do you have over there for pythons?

ionelmc added a commit that referenced this issue Dec 13, 2023
@PureTryOut
Copy link

Python 3.11.6 for Alpine Linux

@ionelmc
Copy link
Owner

ionelmc commented Dec 13, 2023

@PureTryOut does 04dc542 fix it?

@PureTryOut
Copy link

Sadly no, exact same error as before.

@ionelmc
Copy link
Owner

ionelmc commented Dec 14, 2023

Tried it on a alpine:egde docker image and I cannot reproduce this. Can you make a reproducer that uses docker?

@QuLogic
Copy link
Contributor Author

QuLogic commented Dec 14, 2023

Something like this reproduces it:

$ podman run --rm -it fedora:rawhide
# dnf install -y python3-pytest python3-devel python3-twisted
# curl -O https://files.pythonhosted.org/packages/1a/df/4f2cd7eaa6d41a7994d46527349569d46e34d9cdd07590b5c5b0dcf53de3/tblib-3.0.0.tar.gz
# tar xf tblib-3.0.0.tar.gz
# cd tblib-3.0.0
# pip install .
# pytest

@QuLogic
Copy link
Contributor Author

QuLogic commented Dec 14, 2023

You can try from git in there (which doesn't pass either.)

@ionelmc
Copy link
Owner

ionelmc commented Dec 15, 2023

Ok try 66e14cd - pretty sure that works.

@QuLogic
Copy link
Contributor Author

QuLogic commented Dec 18, 2023

Yep, that works for me at least, on all supported Fedora releases.

@PureTryOut
Copy link

I can confirm, that works on Alpine!

AdamWill added a commit to AdamWill/python-tblib that referenced this issue Jun 18, 2024
With Python 3.13, we need to strip even harder, because we get
location lines with differing amounts of tildes and up carets in
them, e.g.:

    ~~^~~~~

and:

    ^^^^^^^

Let's ditch the regex and instead go line-by-line with a pretty
loose match for anything that looks like a location line.

Signed-off-by: Adam Williamson <[email protected]>
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

No branches or pull requests

3 participants