test: code exec on mac (#1549)

Summary:
1. adds option to not use bwrap for code execution
2. disable bwrap when running tests on macs

Test Plan:
```
LLAMA_STACK_CONFIG=fireworks pytest -s -v tests/integration/agents/test_agents.py --safety-shield meta-llama/Llama-Guard-3-8B --text-model meta-llama/Llama-3.1-8B-Instruct
```

Verify code_interpreter result in logs

INFO 2025-03-11 08:10:39,858
llama_stack.providers.inline.agents.meta_reference.agent_instance:1032
agents: tool
call code_interpreter completed with result:
content='completed\n\n541\n' error_message=None error_code=None
         metadata=None
This commit is contained in:
ehhuang 2025-03-12 19:21:53 -07:00 committed by GitHub
parent 2baf200b63
commit 6bfcb65343
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 5260 additions and 906 deletions

View file

@ -6,12 +6,17 @@
import inspect
import itertools
import os
import platform
import textwrap
from dotenv import load_dotenv
from llama_stack.log import get_logger
from .report import Report
logger = get_logger(__name__, category="tests")
def pytest_configure(config):
config.option.tbstyle = "short"
@ -24,6 +29,10 @@ def pytest_configure(config):
key, value = env_var.split("=", 1)
os.environ[key] = value
if platform.system() == "Darwin": # Darwin is the system name for macOS
os.environ["DISABLE_CODE_SANDBOX"] = "1"
logger.info("Setting DISABLE_CODE_SANDBOX=1 for macOS")
if config.getoption("--report"):
config.pluginmanager.register(Report(config))