-
-
Notifications
You must be signed in to change notification settings - Fork 321
Closed
Labels
Description
Describe the bug
It is not safe to use get_x_argument(as_dictionary=True) because it fails with -x foo.
Expected behavior
I'd expect an empty string "" (or True? or None?) as value instead of breaking my script.
To Reproduce
from unittest.mock import Mock
from alembic.config import Config
from alembic.runtime.environment import EnvironmentContext
from alembic.script import ScriptDirectory
context = EnvironmentContext(Config(cmd_opts=Mock(x="foo")), ScriptDirectory("."))
context.get_x_argument(as_dictionary=True)Error
$ python example.py
Traceback (most recent call last):
File "example.py", line 8, in <module>
context.get_x_argument(as_dictionary=True)
File "alembic/runtime/environment.py", line 331, in get_x_argument
value = dict(arg.split("=", 1) for arg in value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: dictionary update sequence element #0 has length 1; 2 is required
Versions.
- OS:
- Python:
- Alembic:
- SQLAlchemy:
- Database:
- DBAPI:
Additional context
Have a nice day!
Reactions are currently unavailable