-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
27 lines (20 loc) · 758 Bytes
/
Copy pathconftest.py
File metadata and controls
27 lines (20 loc) · 758 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
import logging
import pytest
import os
import time
from dotenv import load_dotenv
logger = logging.getLogger(__name__)
load_dotenv()
@pytest.fixture(autouse=True)
def import_environment_variables(request):
try:
request.config.access_key = os.environ["ACCESS_KEY"]
logger.info("Environment variables loaded in request fixture: [access_key]")
except KeyError as e:
logger.error(f"Environment variable does not exist: {e}")
pytest.exit("Could not load environment variables")
@pytest.fixture(autouse=True)
def wait_before_each_test(request):
"""Slow down the execution by inserting a delay before each test"""
logger.info(f"Wait 3 seconds before starting test case: {request.node.name}")
time.sleep(3)