Skip to content

Commit ff4ded1

Browse files
committed
feat(tests): enhance testing framework with new fixtures and end-to-end tests
- Added pytest fixtures for alembic configuration and SQLite engine to streamline database testing. - Introduced comprehensive end-to-end tests for database workflows, covering guild onboarding and disaster recovery scenarios. - Removed outdated README and integration tests to improve test organization and clarity. - Updated integration and unit tests to ensure robust coverage of database operations and model functionality. - Enhanced documentation for test organization and best practices in the README.
1 parent f59a0fa commit ff4ded1

14 files changed

+3145
-682
lines changed

tests/README.md

Lines changed: 0 additions & 448 deletions
This file was deleted.

tests/conftest.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,28 @@ def pytest_report_header(config: pytest.Config) -> str:
164164
f"locale={os.environ.get('LC_ALL') or os.environ.get('LANG')} "
165165
f"network={'allowed' if config.getoption('--allow-network') else 'blocked (unit)'}"
166166
)
167+
168+
169+
# -----------------------------
170+
# Pytest-alembic fixtures
171+
# -----------------------------
172+
173+
@pytest.fixture
174+
def alembic_config():
175+
"""Configure pytest-alembic to use our migration setup."""
176+
from pytest_alembic.config import Config
177+
178+
return Config(
179+
config_options={
180+
"script_location": "src/tux/database/migrations",
181+
},
182+
)
183+
184+
185+
@pytest.fixture
186+
def alembic_engine():
187+
"""Provide a test database engine for pytest-alembic."""
188+
from sqlalchemy import create_engine
189+
190+
# Use SQLite for pytest-alembic tests (simpler and more reliable)
191+
return create_engine("sqlite:///test_alembic.db")

tests/e2e/__init__.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1-
# E2E tests package
1+
"""
2+
End-to-end tests for Tux database workflows.
3+
4+
These tests simulate complete user journeys and real-world scenarios:
5+
- First-time bot setup workflows
6+
- Complete feature usage scenarios
7+
- Data migration between versions
8+
- Scalability and performance testing
9+
- Disaster recovery scenarios
10+
11+
Run with: pytest --run-e2e tests/e2e/
12+
"""

0 commit comments

Comments
 (0)