that initial commit
This commit is contained in:
48
tests/conftest.py
Normal file
48
tests/conftest.py
Normal file
@@ -0,0 +1,48 @@
|
||||
"""
|
||||
Pytest configuration and fixtures for StarPunk tests
|
||||
"""
|
||||
|
||||
import pytest
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
from starpunk import create_app
|
||||
from starpunk.database import init_db
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def app():
|
||||
"""Create test Flask application"""
|
||||
# Create temporary directory for test data
|
||||
temp_dir = tempfile.mkdtemp()
|
||||
temp_path = Path(temp_dir)
|
||||
|
||||
# Test configuration
|
||||
config = {
|
||||
'TESTING': True,
|
||||
'DEBUG': False,
|
||||
'DATA_PATH': temp_path,
|
||||
'NOTES_PATH': temp_path / 'notes',
|
||||
'DATABASE_PATH': temp_path / 'test.db',
|
||||
'SESSION_SECRET': 'test-secret-key',
|
||||
'ADMIN_ME': 'https://test.example.com',
|
||||
'SITE_URL': 'http://localhost:5000',
|
||||
}
|
||||
|
||||
# Create app with test config
|
||||
app = create_app(config)
|
||||
|
||||
yield app
|
||||
|
||||
# Cleanup (optional - temp dir will be cleaned up by OS)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def client(app):
|
||||
"""Create test client"""
|
||||
return app.test_client()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def runner(app):
|
||||
"""Create test CLI runner"""
|
||||
return app.test_cli_runner()
|
||||
Reference in New Issue
Block a user