forked from cleveragents/cleveragents-core
33 lines
929 B
Python
33 lines
929 B
Python
"""Behave environment setup for feature tests."""
|
|
|
|
from pathlib import Path
|
|
import os
|
|
|
|
|
|
def before_all(context):
|
|
"""Set up test environment before all tests."""
|
|
# Use the actual Plandex repository if it exists
|
|
plandex_path = Path("/app/plandex")
|
|
if plandex_path.exists():
|
|
context.plandex_root = plandex_path
|
|
else:
|
|
# Tests will skip if Plandex directory doesn't exist
|
|
context.plandex_root = None
|
|
|
|
|
|
def after_scenario(context, scenario):
|
|
"""Clean up after each scenario."""
|
|
# Clean up environment variables set during tests
|
|
if hasattr(context, "env_vars_to_clean"):
|
|
for key in context.env_vars_to_clean:
|
|
os.environ.pop(key, None)
|
|
context.env_vars_to_clean = []
|
|
|
|
# Reset Settings singleton if it was used
|
|
try:
|
|
from cleveragents.config.settings import Settings
|
|
|
|
Settings._instance = None
|
|
except ImportError:
|
|
pass
|