Open kloczek opened 4 months ago
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
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? 🤔
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.
Could you please report that but as looks like it would be easier for you what is wrong in this case? 🤔
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.
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
build
with--no-isolation
I'm using during all processes only locally installed modulesinstaller
modulecut off from access to the public network
(pytest is executed with-m "not network"
)Here is pytest output:
```console + 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)List of installed modules in build env:
```console 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.