github
6 of 14 new or added lines in 1 file covered. (42.86%)
4 existing lines in 1 file now uncovered.578 of 697 relevant lines covered (82.93%)
0.83 hits per line
1 |
# conftest.py
|
|
2 |
from openai import AsyncOpenAI, OpenAI |
1✔ |
3 |
import pytest |
1✔ |
|
import os |
1✔ |
5 |
|
|
|
try:
|
1✔ |
|
import braintrust |
1✔ |
8 |
|
|
NEW
|
wrap_openai = braintrust.wrap_openai |
× |
|
except ImportError: |
1✔ |
11 |
|
|
|
def wrap_openai(x): |
1✔ |
NEW
|
return x
|
× |
14 |
|
|
|
pass
|
1✔ |
16 |
|
|
17 |
|
|
18 |
@pytest.fixture(scope="session") |
1✔ |
19 |
def client(): |
1✔ |
NEW
|
if "BRAINTRUST_API_KEY" in os.environ: |
× |
21 |
yield wrap_openai(
|
|
22 |
OpenAI( |
|
23 |
api_key=os.environ["BRAINTRUST_API_KEY"],
|
|
24 |
base_url="https://proxy.braintrustapi.com/v1",
|
|
25 |
) |
|
26 |
) |
|
NEW
UNCOV
|
else:
|
× |
NEW
UNCOV
|
yield OpenAI()
|
× |
29 |
|
|
30 |
|
|
31 |
@pytest.fixture(scope="session") |
1✔ |
32 |
def aclient(): |
1✔ |
NEW
|
if "BRAINTRUST_API_KEY" in os.environ: |
× |
34 |
yield wrap_openai(
|
|
35 |
AsyncOpenAI( |
|
36 |
api_key=os.environ["BRAINTRUST_API_KEY"],
|
|
37 |
base_url="https://proxy.braintrustapi.com/v1",
|
|
38 |
) |
|
39 |
) |
|
NEW
UNCOV
|
else:
|
× |
NEW
UNCOV
|
yield AsyncOpenAI()
|
× |