-
Notifications
You must be signed in to change notification settings - Fork 167
Open
Description
Description
Running pytest it inside docker container, throws these warnings:
tests-1 | tests/test_title_endpoint.py::test_title_auth_should_fail
tests-1 | /home/###/<repo>/tests/test_title_endpoint.py:16: FormattingFailedWarning:
tests-1 | Ensure you are either:
tests-1 | (1) passing an f-string directly, with inspect_arguments enabled and working, or
tests-1 | (2) passing a literal `str.format`-style template, not a preformatted string.
tests-1 | See https://logfire.pydantic.dev/docs/guides/onboarding-checklist/add-manual-tracing/#messages-and-span-names.
tests-1 | The problem was: The field {"detail"} is not defined.
# OR:
tests-1 | tests/test_title_endpoint.py::test_generate_title_conversation_not_exists
tests-1 | /home/###/<repo>/tests/test_title_endpoint.py:63: InspectArgumentsFailedWarning: Failed to introspect calling code. Please report this issue to Logfire. Falling back to normal message formatting which may result in loss of information if using an f-string. Set inspect_arguments=False in logfire.configure() to suppress this warning. The problem was:
tests-1 | No source code available. This happens when running in an interactive shell, using exec(), or running .pyc files without the source .py files.
but running pytest in .venv using these commands:
uv sync --group dev
uv run pytest
pass perfectly fine.
this one specificaly was generated here:
logfire.debug(f"Response status code: {response.status_code}, response text: {response.text}")
I configure the logging inside this fixture
@pytest.fixture(scope="session", autouse=True)
def logging():
logfire.configure(
token=settings.logfire_token,
send_to_logfire="if-token-present",
distributed_tracing=False,
service_name="pytest",
environment="test",
)
with logfire.span(f"Test run: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}"):
yield # tests will run here
pyproject.toml:
[project]
name = "assistant"
version = "0.2.1"
description = "Main assistant core logic"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"cachetools>=6.2.0",
"cryptography>=45.0.6",
"elevenlabs>=2.8.1",
"fastapi>=0.115.14",
"logfire[fastapi,httpx,sqlalchemy]>=3.21.2",
"numpy>=2.3.1",
"openai>=1.93.0",
"pgvector>=0.4.1",
"psycopg2-binary>=2.9.10",
"pydantic-settings>=2.10.1",
"pyyaml>=6.0.2",
"sse-starlette>=2.4.1",
"sqlmodel>=0.0.24",
"uvicorn>=0.35.0",
"pydantic-ai-slim[mcp]==1.0.2",
"pyjwt>=2.10.1",
"pydantic-evals[logfire]>=1.0.2",
]
[tool.pytest.ini_options]
addopts = [
"--verbose",
"-ra",
"--color=yes",
"tests/",
]
pythonpath = [
"."
]
doctest_optionflags = [
"NORMALIZE_WHITESPACE",
"NUMBER",
"ELLIPSIS",
"IGNORE_EXCEPTION_DETAIL",
]
[tool.ruff]
line-length = 120
target-version = "py312"
[tool.ruff.lint]
ignore = ["E501"]
select = ["E", "F", "I", "UP"]
[tool.ty.rules]
unresolved-attribute = "ignore"
unknown-argument = "ignore"
[tool.commitizen]
name = "cz_conventional_commits"
tag_format = "v$version"
version_scheme = "pep440"
version_provider = "pep621"
update_changelog_on_bump = true
[dependency-groups]
dev = [
"pre-commit>=4.2.0",
"pytest>=8.4.1",
"ruff>=0.12.0",
"commitizen>=4.8.3",
"pytest-tornasync>=0.6.0.post2",
"ty>=0.0.1a19",
"pytest-cov>=6.2.1",
"pytest-asyncio>=1.2.0",
]
Dockerfile:
FROM python:3.12-slim-trixie
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
WORKDIR /app
COPY jwt-rsa-public.pem jwt-rsa-public.pem
COPY mcp_config.json mcp_config.json
COPY ../pyproject.toml pyproject.toml
COPY ../uv.lock uv.lock
RUN uv sync --locked --group dev
COPY ../lib/ lib/
COPY main.py main.py
COPY ../src/ src/
COPY ../tests/ tests/
CMD ["uv", "run", "pytest"]
Python, Logfire & OS Versions, related packages (not required)
❯ logfire info
logfire="4.10.0"
platform="Linux-6.15.5-061505-generic-x86_64-with-glibc2.41"
python="3.12.11 (main, Jun 12 2025, 12:40:51) [Clang 20.1.4 ]"
[related_packages]
requests="2.32.5"
pydantic="2.11.9"
fastapi="0.118.0"
openai="2.0.0"
protobuf="6.32.1"
rich="14.1.0"
executing="2.2.1"
opentelemetry-api="1.37.0"
opentelemetry-exporter-otlp-proto-common="1.37.0"
opentelemetry-exporter-otlp-proto-http="1.37.0"
opentelemetry-instrumentation="0.58b0"
opentelemetry-instrumentation-asgi="0.58b0"
opentelemetry-instrumentation-fastapi="0.58b0"
opentelemetry-instrumentation-httpx="0.58b0"
opentelemetry-instrumentation-sqlalchemy="0.58b0"
opentelemetry-proto="1.37.0"
opentelemetry-sdk="1.37.0"
opentelemetry-semantic-conventions="0.58b0"
opentelemetry-util-http="0.58b0"
Metadata
Metadata
Assignees
Labels
No labels