mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-19 23:14:25 +01:00
* Add workspace abstraction * Remove old workspace implementation * Extract path resolution to a helper function * Add api key requirements to new tests
28 lines
641 B
Python
28 lines
641 B
Python
import functools
|
|
import os
|
|
|
|
import pytest
|
|
|
|
|
|
def requires_api_key(env_var):
|
|
def decorator(func):
|
|
@functools.wraps(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
|
|
|
|
|
|
def skip_in_ci(test_function):
|
|
return pytest.mark.skipif(
|
|
os.environ.get("CI") == "true",
|
|
reason="This test doesn't work on GitHub Actions.",
|
|
)(test_function)
|