Otherwise alembic/env.py gets executed out of context at test collection stage (via tox -e unit >> run_tests.sh), which raises an AttributeError (alembic.context is not set in this case). Same solution as in 3be1f6fef3 Also minor reformat.
3be1f6fef3
distutils.version
packaging.version