File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15+ import os
16+
17+ from google import genai
18+
19+ import pytest
20+
1521import textgen_chat_with_txt
1622import textgen_chat_with_txt_stream
1723import textgen_with_txt
1824import textgen_with_txt_img
1925import textgen_with_txt_stream
2026
2127
28+ PROJECT_ID = os .getenv ("GOOGLE_CLOUD_PROJECT" )
29+
30+
31+ @pytest .fixture (autouse = True )
32+ def setup_client ():
33+ original_Client = genai .Client
34+
35+ class AutoInitClient (original_Client ):
36+ def __new__ (cls , * args , ** kwargs ):
37+ return original_Client (
38+ vertexai = True ,
39+ project = PROJECT_ID ,
40+ location = "us-central1"
41+ )
42+
43+ genai .Client = AutoInitClient
44+
45+ yield
46+
47+ genai .Client = original_Client
48+
49+
2250def test_textgen_with_txt () -> None :
2351 response = textgen_with_txt .generate_content ()
2452 assert response
You can’t perform that action at this time.
0 commit comments