4693 lines
203 KiB
XML
4693 lines
203 KiB
XML
<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="51" failures="0" skipped="0" tests="54" time="0.624" timestamp="2023-10-23T14:13:46.011441" hostname="satella"><testcase classname="functional.test_auth" name="test_user_registration" time="0.001"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_auth" name="test_user_registration_duplicate_email" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_auth" name="test_user_registration_invalid_json[payload0]" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_auth" name="test_user_registration_invalid_json[payload1]" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_auth" name="test_user_registration_invalid_json[payload2]" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_auth" name="test_user_registration_invalid_json[payload3]" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_auth" name="test_user_registration_invalid_json[payload4]" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_auth" name="test_user_registration_invalid_json[payload5]" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_auth" name="test_user_registration_invalid_json[payload6]" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_auth" name="test_registered_user_login" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_auth" name="test_not_registered_user_login" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_auth" name="test_valid_refresh" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_auth" name="test_invalid_refresh_expired_token" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_auth" name="test_invalid_refresh" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_auth" name="test_user_status" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_auth" name="test_invalid_status" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_user_model" name="test_passwords_are_random" time="0.001"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_user_model" name="test_encode_token[access]" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_user_model" name="test_encode_token[refresh]" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_user_model" name="test_decode_token[access]" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_user_model" name="test_decode_token[refresh]" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_users" name="test_add_user" time="0.001"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_users" name="test_add_user_invalid_json" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_users" name="test_add_user_invalid_json_keys" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_users" name="test_add_user_duplicate_email" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_users" name="test_single_user" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_users" name="test_single_user_incorrect_id" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_users" name="test_all_users" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_users" name="test_remove_user" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_users" name="test_remove_user_incorrect_id" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_users" name="test_update_user" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_users" name="test_update_user_invalid[1-payload0-400-Input payload validation failed]" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_users" name="test_update_user_invalid[1-payload1-400-Input payload validation failed]" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_users" name="test_update_user_invalid[999-payload2-404-User 999 does not exist]" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_users" name="test_update_user_duplicate_email" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="functional.test_users" name="test_update_user_with_passord" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="unit.test_config" name="test_development_config" time="0.001"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="unit.test_config" name="test_testing_config" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="unit.test_config" name="test_production_config" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="unit.test_config" name="test_production_db_url_rewrite" time="0.000" /><testcase classname="unit.test_generic" name="test_model_create_response" time="0.000" /><testcase classname="unit.test_generic" name="test_get_model_error_response" time="0.000" /><testcase classname="unit.test_users" name="test_add_user" time="0.001"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="unit.test_users" name="test_add_user_duplicate_email" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="unit.test_users" name="test_single_user" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="unit.test_users" name="test_single_user_incorrect_id" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="unit.test_users" name="test_all_users" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="unit.test_users" name="test_remove_user" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="unit.test_users" name="test_remove_user_incorrect_id" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="unit.test_users" name="test_update_user" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="unit.test_users" name="test_update_user_invalid[1-payload0-400-Input payload validation failed]" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="unit.test_users" name="test_update_user_invalid[1-payload1-400-Input payload validation failed]" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="unit.test_users" name="test_update_user_invalid[999-payload2-404-User 999 does not exist]" time="0.000"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase><testcase classname="unit.test_users" name="test_update_user_duplicate_email" time="0.001"><error message="failed on setup with "RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."">@pytest.fixture(scope="module")
|
|
def test_app():
|
|
> app = create_app()
|
|
|
|
src/tests/conftest.py:17:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
src/__init__.py:23: in create_app
|
|
db.init_app(app)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
self = <SQLAlchemy>, app = <Flask 'src'>
|
|
|
|
def init_app(self, app: Flask) -> None:
|
|
"""Initialize a Flask application for use with this extension instance. This
|
|
must be called before accessing the database engine or session with the app.
|
|
|
|
This sets default configuration values, then configures the extension on the
|
|
application and creates the engines for each bind key. Therefore, this must be
|
|
called after the application has been configured. Changes to application config
|
|
after this call will not be reflected.
|
|
|
|
The following keys from ``app.config`` are used:
|
|
|
|
- :data:`.SQLALCHEMY_DATABASE_URI`
|
|
- :data:`.SQLALCHEMY_ENGINE_OPTIONS`
|
|
- :data:`.SQLALCHEMY_ECHO`
|
|
- :data:`.SQLALCHEMY_BINDS`
|
|
- :data:`.SQLALCHEMY_RECORD_QUERIES`
|
|
- :data:`.SQLALCHEMY_TRACK_MODIFICATIONS`
|
|
|
|
:param app: The Flask application to initialize.
|
|
"""
|
|
if "sqlalchemy" in app.extensions:
|
|
raise RuntimeError(
|
|
"A 'SQLAlchemy' instance has already been registered on this Flask app."
|
|
" Import and use that instance instead."
|
|
)
|
|
|
|
app.extensions["sqlalchemy"] = self
|
|
|
|
if self._add_models_to_shell:
|
|
from .cli import add_models_to_shell
|
|
|
|
app.shell_context_processor(add_models_to_shell)
|
|
|
|
if app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN", False):
|
|
import warnings
|
|
|
|
warnings.warn(
|
|
"'SQLALCHEMY_COMMIT_ON_TEARDOWN' is deprecated and will be removed in"
|
|
" Flask-SQAlchemy 3.1. Call 'db.session.commit()'` directly instead.",
|
|
DeprecationWarning,
|
|
)
|
|
app.teardown_appcontext(self._teardown_commit)
|
|
else:
|
|
app.teardown_appcontext(self._teardown_session)
|
|
|
|
basic_uri: str | sa.engine.URL | None = app.config.setdefault(
|
|
"SQLALCHEMY_DATABASE_URI", None
|
|
)
|
|
basic_engine_options = self._engine_options.copy()
|
|
basic_engine_options.update(
|
|
app.config.setdefault("SQLALCHEMY_ENGINE_OPTIONS", {})
|
|
)
|
|
echo: bool = app.config.setdefault("SQLALCHEMY_ECHO", False)
|
|
config_binds: dict[
|
|
str | None, str | sa.engine.URL | dict[str, t.Any]
|
|
] = app.config.setdefault("SQLALCHEMY_BINDS", {})
|
|
engine_options: dict[str | None, dict[str, t.Any]] = {}
|
|
|
|
# Build the engine config for each bind key.
|
|
for key, value in config_binds.items():
|
|
engine_options[key] = self._engine_options.copy()
|
|
|
|
if isinstance(value, (str, sa.engine.URL)):
|
|
engine_options[key]["url"] = value
|
|
else:
|
|
engine_options[key].update(value)
|
|
|
|
# Build the engine config for the default bind key.
|
|
if basic_uri is not None:
|
|
basic_engine_options["url"] = basic_uri
|
|
|
|
if "url" in basic_engine_options:
|
|
engine_options.setdefault(None, {}).update(basic_engine_options)
|
|
|
|
if not engine_options:
|
|
> raise RuntimeError(
|
|
"Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set."
|
|
)
|
|
E RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set.
|
|
|
|
/home/slococo/.conda/envs/flights/lib/python3.11/site-packages/flask_sqlalchemy/extension.py:307: RuntimeError</error></testcase></testsuite></testsuites> |