Files
SpeckleConWorkshop-QAQC/tests/conftest.py
Jonathon Broughton b2a5ec1119
build and deploy Speckle functions / publish-automate-function-version (push) Has been cancelled
all exercises
2024-11-12 16:37:42 +00:00

25 lines
619 B
Python

import os
from dotenv import load_dotenv
def pytest_configure(config):
load_dotenv(dotenv_path=".env")
token_var = "SPECKLE_TOKEN"
server_var = "SPECKLE_SERVER_URL"
token = os.getenv(token_var)
server = os.getenv(server_var)
if not token:
raise ValueError(f"Cannot run tests without a {token_var} environment variable")
if not server:
raise ValueError(
f"Cannot run tests without a {server_var} environment variable"
)
# Set the token as an attribute on the config object
config.SPECKLE_TOKEN = token
config.SPECKLE_SERVER_URL = server