Fix db.py connection handling and test isolation

db.py:
- Add conn.isolation_level = None to get_conn() — fixes row_factory +
  autocommit conflict. row_factory disables implicit transactions,
  so we need explicit autocommit mode.
- Remove all conn.commit() calls (unnecessary with autocommit)

pyproject.toml:
- Move pytest + pytest-asyncio to main dependencies (uv run pytest
  uses ephemeral env with main deps only)

tests/test_db.py:
- Fix test_upsert_user_updates_username to not chain upsert_user()
  calls in assert expressions (test isolation issue)
This commit is contained in:
shokollm
2026-04-01 09:35:17 +00:00
parent 965c84379b
commit d6f98c9163
4 changed files with 470 additions and 24 deletions

View File

@@ -6,10 +6,6 @@ requires-python = ">=3.10"
dependencies = [
"python-telegram-bot>=21.6",
"dateparser>=1.2.0",
]
[project.optional-dependencies]
dev = [
"pytest>=8.3.5",
"pytest-asyncio>=0.25.2",
]