Skip to content

Commit

Permalink
make pytest and linter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantumChemist committed Feb 9, 2025
1 parent 050291b commit 20660b9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/openglados.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ jobs:
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
CHICHI: ${{ secrets.CHICHI }}
TENOR_API_KEY: ${{ secrets.TENOR_API_KEY }}
PYTEST_RUNNING: "1"
run: |
pytest
20 changes: 15 additions & 5 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,17 @@
replace_mentions_with_display_names,
generate_plot,
)
from variables import WHITELIST_GUILDS_ID, BLACKLIST_USERS_ID # noqa: F401

# Conditional import for testing
if os.getenv("PYTEST_RUNNING"):
from unittest.mock import Mock
import sys

sys.modules["variables"] = Mock()
sys.modules["variables"].WHITELIST_GUILDS_ID = []
sys.modules["variables"].BLACKLIST_USERS_ID = []
else:
from variables import WHITELIST_GUILDS_ID, BLACKLIST_USERS_ID # noqa: F401

# Directory to save screenshots
SCREENSHOTS_DIR = "screenshots"
Expand All @@ -55,10 +65,10 @@
# Load environment variables from .env file
load_dotenv()

if not BLACKLIST_USERS_ID:
BLACKLIST_USERS_ID = []
if not WHITELIST_GUILDS_ID:
WHITELIST_GUILDS_ID = []
if not sys.modules["variables"].BLACKLIST_USERS_ID:
sys.modules["variables"].BLACKLIST_USERS_ID = []
if not sys.modules["variables"].WHITELIST_GUILDS_ID:
sys.modules["variables"].WHITELIST_GUILDS_ID = []


# Define your custom bot class
Expand Down

0 comments on commit 20660b9

Please sign in to comment.