A wheel whose top-level module is `app` collides with anything else in a user's venv, so the package that is about to be published takes the name it is published under. Only the Python package moves; the repo, the Docker WORKDIR and the compose project keep theirs. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
34 lines
945 B
Python
34 lines
945 B
Python
from unittest.mock import MagicMock, patch
|
|
|
|
from sqlmodel import select
|
|
|
|
from fluksio.tests_pre_start import init, logger
|
|
|
|
|
|
def test_init_successful_connection() -> None:
|
|
engine_mock = MagicMock()
|
|
|
|
session_mock = MagicMock()
|
|
session_mock.__enter__.return_value = session_mock
|
|
|
|
select1 = select(1)
|
|
|
|
with (
|
|
patch("fluksio.tests_pre_start.Session", return_value=session_mock),
|
|
patch("fluksio.tests_pre_start.select", return_value=select1),
|
|
patch.object(logger, "info"),
|
|
patch.object(logger, "error"),
|
|
patch.object(logger, "warn"),
|
|
):
|
|
try:
|
|
init(engine_mock)
|
|
connection_successful = True
|
|
except Exception:
|
|
connection_successful = False
|
|
|
|
assert connection_successful, (
|
|
"The database connection should be successful and not raise an exception."
|
|
)
|
|
|
|
session_mock.exec.assert_called_once_with(select1)
|