-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add more tests around proper usage patterns (#60)
- Loading branch information
Showing
6 changed files
with
104 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,30 @@ | ||
import os | ||
|
||
import pytest | ||
from dotenv import load_dotenv | ||
|
||
import gentrace | ||
from fixtures.aioresponse import mockaio | ||
from fixtures.completion import completion_response | ||
from fixtures.embedding import embedding_response | ||
from fixtures.gentrace import gentrace_pipeline_run_response | ||
|
||
|
||
@pytest.fixture() | ||
def setupTeardown(): | ||
gentrace.api_key = os.getenv("GENTRACE_API_KEY") | ||
gentrace.host = "http://localhost:3000/api/v1" | ||
|
||
gentrace.configure_openai() | ||
|
||
yield "done" | ||
gentrace.api_key = "" | ||
gentrace.host = "" | ||
|
||
|
||
def setup(): | ||
print("Invoking setup") | ||
|
||
|
||
def pytest_configure(): | ||
load_dotenv() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import os | ||
from unittest.mock import create_autospec | ||
|
||
import pytest | ||
from urllib3.response import HTTPResponse | ||
|
||
import gentrace | ||
|
||
|
||
def test_should_raise_error(): | ||
with pytest.raises(ValueError): | ||
gentrace.configure_openai() | ||
|
||
gentrace.api_key = os.getenv("GENTRACE_API_KEY") | ||
gentrace.host = "http://localhost:3000/api/v1" | ||
|
||
|
||
def test_should_not_raise_error(): | ||
gentrace.api_key = os.getenv("GENTRACE_API_KEY") | ||
gentrace.host = "http://localhost:3000/api/v1" | ||
|
||
gentrace.configure_openai() |