Testing fails with alembic 0.9.6
Alembic 0.9.6 has been released and it breaks tests. A typical failure is at https://gitlab.com/msapiro/mailman/-/jobs/36321049. The tracebacks I see may vary depending on the actual test scenario, but I think they all end with
File "/var/MM/3/master/mailman/.tox/py35-nocov/lib/python3.5/site-packages/alembic/util/compat.py", line 83, in load_module_py
spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/var/MM/3/master/mailman/src/mailman/database/alembic/env.py", line 38, in <module>
@public
File "/var/MM/3/master/mailman/.tox/py35-nocov/lib/python3.5/site-packages/public/public.py", line 15, in public
else sys.modules[thing.__module__].__dict__)
KeyError: 'env_py'
I haven't tried to report this to Alembic as I'm not sure if it's our fault or not. It seems strange. What I think is happening is alembic is calling mailman.database.alembic.env.run_migrations_offline()
and there is an @public
decorator on that function which begins
# http://bugs.python.org/issue26632
def public(thing=None, **kws):
mdict = (sys._getframe(1).f_globals
if thing is None
else sys.modules[thing.__module__].__dict__)
and apparently thing.__module__
is env_py
and that is not a key in sys.modules
so the KeyError
is thrown.