34 lines
690 B
Python
34 lines
690 B
Python
"""
|
|
Pytest configuration and fixtures
|
|
"""
|
|
|
|
import sys
|
|
import os
|
|
import pytest
|
|
|
|
# Add the parent directory to the Python path so we can import the app
|
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
from app import app as flask_app
|
|
|
|
|
|
@pytest.fixture
|
|
def app():
|
|
"""Create and configure a new app instance for each test."""
|
|
flask_app.config['TESTING'] = True
|
|
flask_app.config['WTF_CSRF_ENABLED'] = False
|
|
|
|
yield flask_app
|
|
|
|
|
|
@pytest.fixture
|
|
def client(app):
|
|
"""A test client for the app."""
|
|
return app.test_client()
|
|
|
|
|
|
@pytest.fixture
|
|
def runner(app):
|
|
"""A test runner for the app's Click commands."""
|
|
return app.test_cli_runner()
|