-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
34 lines (28 loc) · 908 Bytes
/
conftest.py
File metadata and controls
34 lines (28 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import pytest
import discord.ext.test as dpytest
import discord
from discord.ext import commands
import os
os.chdir("./data") # Project directory
@pytest.fixture
def bot(event_loop):
PREFIX = '>>'
#load_dotenv('.env') # Load TOKEN
print(os.getcwd())
#os.chdir("./data") # Project directory
print(os.getcwd())
intents = discord.Intents(messages=True, members=True, guilds=True, presences=True, reactions=True)
bot = commands.Bot(command_prefix=PREFIX, intents=intents, help_command=None, event=event_loop) # Connection to Discord
bot.load_extension("extension")
dpytest.configure(bot)
return bot
"""
def pytest_sessionfinish():
# Clean up attachment files
files = glob.glob('./dpytest_*.dat')
for path in files:
try:
os.remove(path)
except Exception as e:
print(f"Error while deleting file {path}: {e}")
"""