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

python3.11: failing test_log_messages_have_correct_metadata_echo #8019

Closed
arthurzam opened this issue May 14, 2022 · 10 comments
Closed

python3.11: failing test_log_messages_have_correct_metadata_echo #8019

arthurzam opened this issue May 14, 2022 · 10 comments
Labels
bug Something isn't working tests
Milestone

Comments

@arthurzam
Copy link

arthurzam commented May 14, 2022

Describe the bug

On Gentoo we are currently testing and bumping packages for python 3.11 (currently in beta), during which we try to run the full test suite of package.
We noticed a failure in one single test test_log_messages_have_correct_metadata_echo in the file test/test_logging.py

To Reproduce

Running the following reproduces the test failure on python3.11:

`pytest -s -ra -l -vv test/engine/test_logging.py::TransactionContextLoggingTest::test_log_messages_have_correct_metadata_echo`

Same command for pypy3, python3.8, python3.9, python3.10 passes

Error

=============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.11.0b1, pytest-7.1.2, pluggy-1.0.0 -- /usr/bin/python3.11
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/var/tmp/portage/dev-python/sqlalchemy-1.4.36/work/SQLAlchemy-1.4.36/.hypothesis/examples')
rootdir: /var/tmp/portage/dev-python/sqlalchemy-1.4.36/work/SQLAlchemy-1.4.36, configfile: setup.cfg
plugins: hypothesis-6.46.3, freezegun-0.4.2, asyncio-0.18.3
asyncio: mode=Mode.LEGACY
collected 1 item                                                                                                                                                                                                  

test/engine/test_logging.py::TransactionContextLoggingTest::test_log_messages_have_correct_metadata_echo 2022-05-14 14:58:49,640 INFO sqlalchemy.engine.Engine BEGIN (implicit; DBAPI should not BEGIN due to autocommit mode)
2022-05-14 14:58:49,640 INFO sqlalchemy.engine.Engine ROLLBACK using DBAPI connection.rollback(), DBAPI should ignore due to autocommit mode
FAILED

==================================================================================================== FAILURES =====================================================================================================
___________________________________________________________________ TransactionContextLoggingTest.test_log_messages_have_correct_metadata_echo ____________________________________________________________________
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/sqlalchemy-1.4.36/work/SQLAlchemy-1.4.36/test/engine/test_logging.py", line 788, in test_log_messages_have_correct_metadata_echo
    self._test_log_messages_have_correct_metadata(logging_engine)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/tmp/portage/dev-python/sqlalchemy-1.4.36/work/SQLAlchemy-1.4.36/test/engine/test_logging.py", line 808, in _test_log_messages_have_correct_metadata
    assert any(
    ^^^^^^^^^^^
AssertionError: {'_log_info'}
assert False
 +  where False = any(<generator object TransactionContextLoggingTest._test_log_messages_have_correct_metadata.<locals>.<genexpr> at 0x7fdd269439f0>)
============================================================================================= short test summary info =============================================================================================
FAILED test/engine/test_logging.py::TransactionContextLoggingTest::test_log_messages_have_correct_metadata_echo - AssertionError: {'_log_info'}
================================================================================================ 1 failed in 0.10s ================================================================================================

Versions

  • OS: Gentoo
  • Python: 3.11.0b1
  • SQLAlchemy: 1.4.36

Additional context

No response

@arthurzam arthurzam added the requires triage New issue that requires categorization label May 14, 2022
@zzzeek
Copy link
Member

zzzeek commented May 14, 2022

hey there -

yes packagers testing on 3.11 are hitting some small issues and as yet we've not been able to test effectively on 3.11 due to the non-availability of greenlet and cython for python 3.11. Greenlet in particular. We hope to integrate 3.11 into our CI once we can get Greenlet to build (maybe it can now, wasn't working a couple of weeks ago).

from a packaging perspective I would add patchfiles to patch out this test for now.

@zzzeek zzzeek added bug Something isn't working tests and removed requires triage New issue that requires categorization labels May 14, 2022
@zzzeek zzzeek added this to the 1.4.x milestone May 14, 2022
@arthurzam
Copy link
Author

@zzzeek Thanks for the reply.
This was the way we did for now (skipping the test). I know this is very early stages of python 3.11 and bugs are to be expected, and I wanted just to notify the awesome devs of sqlalchemy that there is a small issue.

@zzzeek
Copy link
Member

zzzeek commented May 14, 2022

we already hit this at Red Hat so I will likely have to run the tests in CI without the greenlet dependency (which is supported, just requires exception cases written out everywhere).

@zzzeek
Copy link
Member

zzzeek commented May 14, 2022

Ive pinged python-greenlet/greenlet#288 on this. I will try to seek adjusting tox to build without greenlet for py311

@sqla-tester
Copy link
Collaborator

Mike Bayer has proposed a fix for this issue in the main branch:

Install on py311 without greenlet; test support https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/3839

@zzzeek
Copy link
Member

zzzeek commented May 14, 2022

@arthurzam do you have a working greenlet build for py311? like a patchfile or something. If I could just put up a fork that builds it would make life a lot simpler on this end rather than skipping it everywhere

@zzzeek
Copy link
Member

zzzeek commented May 14, 2022

nm i got one from their PRs

@arthurzam
Copy link
Author

@zzzeek Currently we skip greenlet on python3.11. You can see out build here.
We have issues with greenlet because of isn't working on arches like hppa or ia64, so we conditionally skip if it is missing

@sqla-tester
Copy link
Collaborator

Mike Bayer has proposed a fix for this issue in the rel_1_4 branch:

Install greenlet from a py311 compat patch https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/3841

@zzzeek
Copy link
Member

zzzeek commented May 14, 2022

to make it more fun, the issue is in py3.11.0b1 and not a4 which is what's on the CI machines, where we have a different failure, so having to upgrade the CI machines

sqlalchemy-bot pushed a commit that referenced this issue May 15, 2022
Fixed issue where support for logging "stacklevel" implemented in
:ticket:`7612` required adjustment to work with recently released Python
3.11.0b1, also repairs the unit tests which tested this feature.

Install greenlet from a py311 compat patch.

re: the stacklevel thing, this is going to be very inconvenient
if we have to keep hardcoding numbers everywhere for every
new python version

Change-Id: I0c8f7293e98c0ca5cc544538284bfd1d3020cb1f
References: python-greenlet/greenlet#288
Fixes: #8019
(cherry picked from commit 43ff5b82dc0d91cacd625ac8943622ab340958c5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tests
Projects
None yet
Development

No branches or pull requests

3 participants