mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2026-01-07 00:04:26 +01:00
move decorator higher up
Signed-off-by: Merwane Hamadi <merwanehamadi@gmail.com>
This commit is contained in:
committed by
Reinier van der Leer
parent
eb5a8a87d8
commit
b7cd56f72b
18
tests/utils.py
Normal file
18
tests/utils.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def requires_api_key(env_var):
|
||||
def decorator(func):
|
||||
def wrapper(*args, **kwargs):
|
||||
if not os.environ.get(env_var):
|
||||
pytest.skip(
|
||||
f"Environment variable '{env_var}' is not set, skipping the test."
|
||||
)
|
||||
else:
|
||||
return func(*args, **kwargs)
|
||||
|
||||
return wrapper
|
||||
|
||||
return decorator
|
||||
Reference in New Issue
Block a user