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

1.12.1 + master (91aa4d89): pytest fails #237

Open
kloczek opened this issue Apr 5, 2024 · 5 comments
Open

1.12.1 + master (91aa4d89): pytest fails #237

kloczek opened this issue Apr 5, 2024 · 5 comments

Comments

@kloczek
Copy link

kloczek commented Apr 5, 2024

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix> using installer module
  • run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
  • build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")
Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-beaker-1.12.1-6.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-beaker-1.12.1-6.fc37.x86_64/usr/lib/python3.10/site-packages
+ /usr/bin/pytest -ra -m 'not network'
2818713:C 05 Apr 2024 09:06:07.859 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
2818713:C 05 Apr 2024 09:06:07.860 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
2818713:C 05 Apr 2024 09:06:07.860 * Redis version=7.2.4, bits=64, commit=00000000, modified=0, pid=2818713, just started
2818713:C 05 Apr 2024 09:06:07.860 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
2818713:M 05 Apr 2024 09:06:07.860 * Increased maximum number of open files to 10032 (it was originally set to 1024).
2818713:M 05 Apr 2024 09:06:07.860 * monotonic clock: POSIX clock_gettime
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 7.2.4 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 2818713
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           https://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

2818713:M 05 Apr 2024 09:06:07.861 # Warning: Could not create server TCP listening socket *:6379: bind: Address already in use
2818713:M 05 Apr 2024 09:06:07.861 # Failed listening on port 6379 (tcp), aborting.
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.10.14, pytest-8.1.1, pluggy-1.4.0
benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/tkloczko/rpmbuild/BUILD/beaker-1.12.1
configfile: setup.cfg
plugins: mock-3.14.0, timeout-2.3.1, hypothesis-6.100.0, flaky-3.8.1, trio-0.8.0, benchmark-4.0.0, betamax-0.9.0, anyio-4.3.0, asyncio-0.23.6
asyncio: mode=strict
collected 19 items / 17 errors

========================================================================================== ERRORS ===========================================================================================
___________________________________________________________________________ ERROR collecting tests/test_cache.py ____________________________________________________________________________
/usr/lib/python3.10/site-packages/_pytest/python.py:525: in importtestmodule
    mod = import_path(
/usr/lib/python3.10/site-packages/_pytest/pathlib.py:584: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
/usr/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_cache.py:9: in <module>
    from beaker.middleware import CacheMiddleware
beaker/middleware.py:11: in <module>
    from beaker.cache import CacheManager
beaker/cache.py:20: in <module>
    import beaker.ext.database as database
beaker/ext/database.py:11: in <module>
    from beaker.ext.sqla import SqlaNamespaceManager
E     File "/home/tkloczko/rpmbuild/BUILD/beaker-1.12.1/beaker/ext/sqla.py", line 84
E       log.debug OSError
E                 ^^^^^^^
E   SyntaxError: invalid syntax
______________________________________________________________________ ERROR collecting tests/test_cache_decorator.py _______________________________________________________________________
/usr/lib/python3.10/site-packages/_pytest/python.py:525: in importtestmodule
    mod = import_path(
/usr/lib/python3.10/site-packages/_pytest/pathlib.py:584: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
/usr/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_cache_decorator.py:4: in <module>
    from beaker.cache import CacheManager, cache_region, region_invalidate
beaker/cache.py:20: in <module>
    import beaker.ext.database as database
beaker/ext/database.py:11: in <module>
    from beaker.ext.sqla import SqlaNamespaceManager
E     File "/home/tkloczko/rpmbuild/BUILD/beaker-1.12.1/beaker/ext/sqla.py", line 84
E       log.debug OSError
E                 ^^^^^^^
E   SyntaxError: invalid syntax
________________________________________________________________________ ERROR collecting tests/test_cachemanager.py ________________________________________________________________________
/usr/lib/python3.10/site-packages/_pytest/python.py:525: in importtestmodule
    mod = import_path(
/usr/lib/python3.10/site-packages/_pytest/pathlib.py:584: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
/usr/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_cachemanager.py:6: in <module>
    from beaker.cache import CacheManager, cache_regions
beaker/cache.py:20: in <module>
    import beaker.ext.database as database
beaker/ext/database.py:11: in <module>
    from beaker.ext.sqla import SqlaNamespaceManager
E     File "/home/tkloczko/rpmbuild/BUILD/beaker-1.12.1/beaker/ext/sqla.py", line 84
E       log.debug OSError
E                 ^^^^^^^
E   SyntaxError: invalid syntax
_________________________________________________________________________ ERROR collecting tests/test_container.py __________________________________________________________________________
/usr/lib/python3.10/site-packages/_pytest/python.py:525: in importtestmodule
    mod = import_path(
/usr/lib/python3.10/site-packages/_pytest/pathlib.py:584: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
/usr/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_container.py:11: in <module>
    from beaker.cache import clsmap
beaker/cache.py:20: in <module>
    import beaker.ext.database as database
beaker/ext/database.py:11: in <module>
    from beaker.ext.sqla import SqlaNamespaceManager
E     File "/home/tkloczko/rpmbuild/BUILD/beaker-1.12.1/beaker/ext/sqla.py", line 84
E       log.debug OSError
E                 ^^^^^^^
E   SyntaxError: invalid syntax
_____________________________________________________________________ ERROR collecting tests/test_cookie_domain_only.py _____________________________________________________________________
/usr/lib/python3.10/site-packages/_pytest/python.py:525: in importtestmodule
    mod = import_path(
/usr/lib/python3.10/site-packages/_pytest/pathlib.py:584: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
/usr/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_cookie_domain_only.py:3: in <module>
    from beaker.middleware import SessionMiddleware
beaker/middleware.py:11: in <module>
    from beaker.cache import CacheManager
beaker/cache.py:20: in <module>
    import beaker.ext.database as database
beaker/ext/database.py:11: in <module>
    from beaker.ext.sqla import SqlaNamespaceManager
E     File "/home/tkloczko/rpmbuild/BUILD/beaker-1.12.1/beaker/ext/sqla.py", line 84
E       log.debug OSError
E                 ^^^^^^^
E   SyntaxError: invalid syntax
_______________________________________________________________________ ERROR collecting tests/test_cookie_expires.py _______________________________________________________________________
/usr/lib/python3.10/site-packages/_pytest/python.py:525: in importtestmodule
    mod = import_path(
/usr/lib/python3.10/site-packages/_pytest/pathlib.py:584: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
/usr/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_cookie_expires.py:1: in <module>
    from beaker.middleware import SessionMiddleware
beaker/middleware.py:11: in <module>
    from beaker.cache import CacheManager
beaker/cache.py:20: in <module>
    import beaker.ext.database as database
beaker/ext/database.py:11: in <module>
    from beaker.ext.sqla import SqlaNamespaceManager
E     File "/home/tkloczko/rpmbuild/BUILD/beaker-1.12.1/beaker/ext/sqla.py", line 84
E       log.debug OSError
E                 ^^^^^^^
E   SyntaxError: invalid syntax
________________________________________________________________________ ERROR collecting tests/test_cookie_only.py _________________________________________________________________________
/usr/lib/python3.10/site-packages/_pytest/python.py:525: in importtestmodule
    mod = import_path(
/usr/lib/python3.10/site-packages/_pytest/pathlib.py:584: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
/usr/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_cookie_only.py:6: in <module>
    import beaker.session
beaker/session.py:8: in <module>
    from beaker.cache import clsmap
beaker/cache.py:20: in <module>
    import beaker.ext.database as database
beaker/ext/database.py:11: in <module>
    from beaker.ext.sqla import SqlaNamespaceManager
E     File "/home/tkloczko/rpmbuild/BUILD/beaker-1.12.1/beaker/ext/sqla.py", line 84
E       log.debug OSError
E                 ^^^^^^^
E   SyntaxError: invalid syntax
__________________________________________________________________________ ERROR collecting tests/test_database.py __________________________________________________________________________
/usr/lib/python3.10/site-packages/_pytest/python.py:525: in importtestmodule
    mod = import_path(
/usr/lib/python3.10/site-packages/_pytest/pathlib.py:584: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
/usr/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_database.py:3: in <module>
    from beaker.cache import clsmap, Cache, util
beaker/cache.py:20: in <module>
    import beaker.ext.database as database
beaker/ext/database.py:11: in <module>
    from beaker.ext.sqla import SqlaNamespaceManager
E     File "/home/tkloczko/rpmbuild/BUILD/beaker-1.12.1/beaker/ext/sqla.py", line 84
E       log.debug OSError
E                 ^^^^^^^
E   SyntaxError: invalid syntax
_______________________________________________________________________ ERROR collecting tests/test_domain_setting.py _______________________________________________________________________
/usr/lib/python3.10/site-packages/_pytest/python.py:525: in importtestmodule
    mod = import_path(
/usr/lib/python3.10/site-packages/_pytest/pathlib.py:584: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
/usr/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_domain_setting.py:1: in <module>
    from beaker.middleware import SessionMiddleware
beaker/middleware.py:11: in <module>
    from beaker.cache import CacheManager
beaker/cache.py:20: in <module>
    import beaker.ext.database as database
beaker/ext/database.py:11: in <module>
    from beaker.ext.sqla import SqlaNamespaceManager
E     File "/home/tkloczko/rpmbuild/BUILD/beaker-1.12.1/beaker/ext/sqla.py", line 84
E       log.debug OSError
E                 ^^^^^^^
E   SyntaxError: invalid syntax
_________________________________________________________________________ ERROR collecting tests/test_increment.py __________________________________________________________________________
/usr/lib/python3.10/site-packages/_pytest/python.py:525: in importtestmodule
    mod = import_path(
/usr/lib/python3.10/site-packages/_pytest/pathlib.py:584: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
/usr/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_increment.py:4: in <module>
    from beaker.middleware import SessionMiddleware
beaker/middleware.py:11: in <module>
    from beaker.cache import CacheManager
beaker/cache.py:20: in <module>
    import beaker.ext.database as database
beaker/ext/database.py:11: in <module>
    from beaker.ext.sqla import SqlaNamespaceManager
E     File "/home/tkloczko/rpmbuild/BUILD/beaker-1.12.1/beaker/ext/sqla.py", line 84
E       log.debug OSError
E                 ^^^^^^^
E   SyntaxError: invalid syntax
_________________________________________________________________ ERROR collecting tests/test_managers/test_ext_mongodb.py __________________________________________________________________
/usr/lib/python3.10/site-packages/_pytest/python.py:525: in importtestmodule
    mod = import_path(
/usr/lib/python3.10/site-packages/_pytest/pathlib.py:584: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
/usr/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_managers/test_ext_mongodb.py:1: in <module>
    from beaker.cache import Cache
beaker/cache.py:20: in <module>
    import beaker.ext.database as database
beaker/ext/database.py:11: in <module>
    from beaker.ext.sqla import SqlaNamespaceManager
E     File "/home/tkloczko/rpmbuild/BUILD/beaker-1.12.1/beaker/ext/sqla.py", line 84
E       log.debug OSError
E                 ^^^^^^^
E   SyntaxError: invalid syntax
__________________________________________________________________ ERROR collecting tests/test_managers/test_ext_redis.py ___________________________________________________________________
/usr/lib/python3.10/site-packages/_pytest/python.py:525: in importtestmodule
    mod = import_path(
/usr/lib/python3.10/site-packages/_pytest/pathlib.py:584: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
/usr/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_managers/test_ext_redis.py:1: in <module>
    from beaker.cache import Cache
beaker/cache.py:20: in <module>
    import beaker.ext.database as database
beaker/ext/database.py:11: in <module>
    from beaker.ext.sqla import SqlaNamespaceManager
E     File "/home/tkloczko/rpmbuild/BUILD/beaker-1.12.1/beaker/ext/sqla.py", line 84
E       log.debug OSError
E                 ^^^^^^^
E   SyntaxError: invalid syntax
_______________________________________________________________ ERROR collecting tests/test_managers/test_ext_rediscluster.py _______________________________________________________________
/usr/lib/python3.10/site-packages/_pytest/python.py:525: in importtestmodule
    mod = import_path(
/usr/lib/python3.10/site-packages/_pytest/pathlib.py:584: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
/usr/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_managers/test_ext_rediscluster.py:1: in <module>
    from beaker.cache import Cache
beaker/cache.py:20: in <module>
    import beaker.ext.database as database
beaker/ext/database.py:11: in <module>
    from beaker.ext.sqla import SqlaNamespaceManager
E     File "/home/tkloczko/rpmbuild/BUILD/beaker-1.12.1/beaker/ext/sqla.py", line 84
E       log.debug OSError
E                 ^^^^^^^
E   SyntaxError: invalid syntax
_________________________________________________________________________ ERROR collecting tests/test_memcached.py __________________________________________________________________________
/usr/lib/python3.10/site-packages/_pytest/python.py:525: in importtestmodule
    mod = import_path(
/usr/lib/python3.10/site-packages/_pytest/pathlib.py:584: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
/usr/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_memcached.py:5: in <module>
    from beaker.cache import Cache, CacheManager, util
beaker/cache.py:20: in <module>
    import beaker.ext.database as database
beaker/ext/database.py:11: in <module>
    from beaker.ext.sqla import SqlaNamespaceManager
E     File "/home/tkloczko/rpmbuild/BUILD/beaker-1.12.1/beaker/ext/sqla.py", line 84
E       log.debug OSError
E                 ^^^^^^^
E   SyntaxError: invalid syntax
__________________________________________________________________________ ERROR collecting tests/test_session.py ___________________________________________________________________________
/usr/lib/python3.10/site-packages/_pytest/python.py:525: in importtestmodule
    mod = import_path(
/usr/lib/python3.10/site-packages/_pytest/pathlib.py:584: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
/usr/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_session.py:15: in <module>
    from beaker.session import CookieSession, Session, SessionObject
beaker/session.py:8: in <module>
    from beaker.cache import clsmap
beaker/cache.py:20: in <module>
    import beaker.ext.database as database
beaker/ext/database.py:11: in <module>
    from beaker.ext.sqla import SqlaNamespaceManager
E     File "/home/tkloczko/rpmbuild/BUILD/beaker-1.12.1/beaker/ext/sqla.py", line 84
E       log.debug OSError
E                 ^^^^^^^
E   SyntaxError: invalid syntax
____________________________________________________________________________ ERROR collecting tests/test_sqla.py ____________________________________________________________________________
/usr/lib/python3.10/site-packages/_pytest/python.py:525: in importtestmodule
    mod = import_path(
/usr/lib/python3.10/site-packages/_pytest/pathlib.py:584: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
/usr/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_sqla.py:2: in <module>
    from beaker.cache import clsmap, Cache, util
beaker/cache.py:20: in <module>
    import beaker.ext.database as database
beaker/ext/database.py:11: in <module>
    from beaker.ext.sqla import SqlaNamespaceManager
E     File "/home/tkloczko/rpmbuild/BUILD/beaker-1.12.1/beaker/ext/sqla.py", line 84
E       log.debug OSError
E                 ^^^^^^^
E   SyntaxError: invalid syntax
_____________________________________________________________________ ERROR collecting tests/test_unicode_cache_keys.py _____________________________________________________________________
/usr/lib/python3.10/site-packages/_pytest/python.py:525: in importtestmodule
    mod = import_path(
/usr/lib/python3.10/site-packages/_pytest/pathlib.py:584: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
/usr/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_unicode_cache_keys.py:8: in <module>
    from beaker.cache import CacheManager
beaker/cache.py:20: in <module>
    import beaker.ext.database as database
beaker/ext/database.py:11: in <module>
    from beaker.ext.sqla import SqlaNamespaceManager
E     File "/home/tkloczko/rpmbuild/BUILD/beaker-1.12.1/beaker/ext/sqla.py", line 84
E       log.debug OSError
E                 ^^^^^^^
E   SyntaxError: invalid syntax
===================================================================================== warnings summary ======================================================================================
../../../../../usr/lib/python3.10/site-packages/_pytest/config/__init__.py:1439
  /usr/lib/python3.10/site-packages/_pytest/config/__init__.py:1439: PytestConfigWarning: Unknown config option: ignore-files

    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

../../../../../usr/lib/python3.10/site-packages/_pytest/config/__init__.py:1439
  /usr/lib/python3.10/site-packages/_pytest/config/__init__.py:1439: PytestConfigWarning: Unknown config option: where

    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================== short test summary info ==================================================================================
ERROR tests/test_cache.py
ERROR tests/test_cache_decorator.py
ERROR tests/test_cachemanager.py
ERROR tests/test_container.py
ERROR tests/test_cookie_domain_only.py
ERROR tests/test_cookie_expires.py
ERROR tests/test_cookie_only.py
ERROR tests/test_database.py
ERROR tests/test_domain_setting.py
ERROR tests/test_increment.py
ERROR tests/test_managers/test_ext_mongodb.py
ERROR tests/test_managers/test_ext_redis.py
ERROR tests/test_managers/test_ext_rediscluster.py
ERROR tests/test_memcached.py
ERROR tests/test_session.py
ERROR tests/test_sqla.py
ERROR tests/test_unicode_cache_keys.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 17 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================== 2 warnings, 17 errors in 2.14s ===============================================================================
List of installed modules in build env:
Package            Version
------------------ -----------
async-timeout      4.0.3
beautifulsoup4     4.12.3
build              1.2.1
cffi               1.16.0
cryptography       42.0.5
exceptiongroup     1.1.3
greenlet           3.0.3
importlib_metadata 7.1.0
iniconfig          2.0.0
installer          0.7.0
packaging          24.0
Paste              3.8.0
pluggy             1.4.0
ply                3.11
pycparser          2.22
pyproject_hooks    1.0.0
pytest             8.1.1
python-dateutil    2.9.0.post0
redis              5.0.3
ruff               0.3.5
setuptools         69.1.1
soupsieve          2.5
SQLAlchemy         2.0.29
tokenize_rt        5.2.0
tomli              2.0.1
typing_extensions  4.10.0
waitress           3.0.0
WebOb              1.8.7
WebTest            3.0.0
wheel              0.43.0
zipp               3.18.1

Please let me know if you need more details or want me to perform some diagnostics.

@amol-
Copy link
Collaborator

amol- commented Apr 5, 2024

Not sure what's going on, but the code you are using doesn't seem to be the one available from Beaker. You are getting a syntax error from a line of code that doesn't exist in the codebase

E     File "/home/tkloczko/rpmbuild/BUILD/beaker-1.12.1/beaker/ext/sqla.py", line 84
E       log.debug OSError
E                 ^^^^^^^
E   SyntaxError: invalid syntax

As you can see there is no such line of code in https://github.com/bbangert/beaker/blob/1.12.1/beaker/ext/sqla.py

@kloczek
Copy link
Author

kloczek commented Apr 6, 2024

Not sure what's going on, but the code you are using doesn't seem to be the one available from Beaker. You are getting a syntax error from a line of code that doesn't exist in the codebase

OK I found what is going on.
I ust found that enabled apply patch generated by pyupgrade --py38-plus.
It added in that file

--- a/beaker/ext/sqla.py
+++ b/beaker/ext/sqla.py
@@ -52,7 +52,7 @@
             verify_directory(self.lock_dir)

         self.bind = self.__class__.binds.get(str(bind.url), lambda: bind)
-        self.table = self.__class__.tables.get('%s:%s' % (bind.url, table.name),
+        self.table = self.__class__.tables.get('{}:{}'.format(bind.url, table.name),
                                                lambda: table)
         self.hash = {}
         self._is_new = False
@@ -80,9 +80,8 @@
             self._is_new = False
             try:
                 self.hash = result.data
-            except (IOError, OSError, EOFError, pickle.PickleError,
-                    pickle.PickleError):
-                log.debug("Couln't load pickle data, creating new storage")
+            except (IOError, OSError, EOFError, pickle.PickleError):
+                log.debug OSError
                 self.hash = {}
                 self._is_new = True
         self.flags = flags

I've been preparing to submit PR with drop python<=3.7 support. First part of those modifications was patch generated by pyupgrade. You can play with that by executing command find . -name \*py | xargs pyupgrade --py38-plus.
I'm not 100% sure what exactly pyupgrade breaks here. Do you see that? 🤔

@AdamWill
Copy link

AdamWill commented Jun 21, 2024

It's the second block, where it changes log.debug("Couln't load pickle data, creating new storage") to log.debug OSError. That's a syntax error; log.debug is a function, not a statement, log.debug OSError is just...wrong.

That whole change is nonsensical, in fact, I don't know what went wrong but it's clearly a bug in pyupgrade. The first block is fine.

@kloczek
Copy link
Author

kloczek commented Jun 21, 2024

Could you please report that but as looks like it would be easier for you what is wrong in this case? 🤔

@AdamWill
Copy link

I've got a zillion other things to do, so no. I mean, just post a bug that shows the before and after of running pyupgrade on that file. Anyone with a basic grounding in Python should understand that log.debug OSError is just all kinds of wrong.

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