Skip to content

Commit c39cb3c

Browse files
committed
chore(tests): initial integration/test_general tests {txt,img}2img
1 parent d0b0e97 commit c39cb3c

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

tests/integration/test_general.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import sys
2+
import os
3+
from .lib import getMinio, getDDA
4+
from test import runTest
5+
6+
7+
class TestGeneralClass:
8+
"""
9+
Typical usage tests, that assume model is already available locally.
10+
txt2img, img2img, inpaint.
11+
"""
12+
13+
CALL_ARGS = {
14+
"MODEL_ID": "stabilityai/stable-diffusion-2-1-base",
15+
"MODEL_PRECISION": "fp16",
16+
"MODEL_REVISION": "fp16",
17+
"MODEL_URL": "s3://",
18+
}
19+
20+
MODEL_ARGS = {"num_inference_steps": 2}
21+
22+
def setup_class(self):
23+
print("setup_class")
24+
# self.minio = minio = getMinio()
25+
26+
HOME = os.getenv("HOME")
27+
self.dda = dda = getDDA(
28+
# minio=minio
29+
# stream_logs=True,
30+
volumes=[f"{HOME}/root-cache:/root/.cache"],
31+
)
32+
print(dda)
33+
34+
self.TEST_ARGS = {"test_url": dda.url}
35+
36+
def teardown_class(self):
37+
print("teardown_class")
38+
# self.minio.stop()
39+
self.dda.stop()
40+
41+
def test_txt2img(self):
42+
result = runTest("txt2img", self.TEST_ARGS, self.CALL_ARGS, self.MODEL_ARGS)
43+
assert result["image_base64"]
44+
45+
def test_img2img(self):
46+
result = runTest("img2img", self.TEST_ARGS, self.CALL_ARGS, self.MODEL_ARGS)
47+
assert result["image_base64"]
48+
49+
# def test_inpaint(self):
50+
# """
51+
# This is actually calling inpaint with SDv2.1, not the inpainting model,
52+
# so I guess we're testing inpaint-legacy.
53+
# """
54+
# result = runTest("inpaint", self.TEST_ARGS, self.CALL_ARGS, self.MODEL_ARGS)
55+
# assert result["image_base64"]

0 commit comments

Comments
 (0)