Skip to content

Commit d889f41

Browse files
author
timhauke
committed
feat(tests): Set default environment variables for CI/unit tests
Set default environment variables for Discord and Lavalink in `conftest.py`. This ensures the configuration bootstrap has the necessary secrets during CI and local unit testing, preventing failures due to missing environment variables.
1 parent 9780464 commit d889f41

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
"""Pytest configuration helpers."""
22

3+
import os
34
import sys
45
from pathlib import Path
56

67
ROOT = Path(__file__).resolve().parents[1]
78

89
if str(ROOT) not in sys.path:
910
sys.path.insert(0, str(ROOT))
11+
12+
# Ensure config bootstrap has the secrets it needs during CI/unit tests.
13+
os.environ.setdefault("DISCORD_TOKEN", "TEST_TOKEN")
14+
os.environ.setdefault("LAVALINK_HOST", "localhost")
15+
os.environ.setdefault("LAVALINK_PORT", "2333")
16+
os.environ.setdefault("LAVALINK_PASSWORD", "testing-token")

0 commit comments

Comments
 (0)