Skip to content

Commit

Permalink
add specific test option
Browse files Browse the repository at this point in the history
  • Loading branch information
aiXander committed Jan 6, 2025
1 parent 3bbe168 commit 38fe432
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion comfyui.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,20 @@
test_workflows = os.getenv("WORKFLOWS")
root_workflows_folder = "../private_workflows" if os.getenv("PRIVATE") else "../workflows"
test_all = True if os.getenv("TEST_ALL") else False
specific_test = os.getenv("SPECIFIC_TEST") if os.getenv("SPECIFIC_TEST") else ""
skip_tests = os.getenv("SKIP_TESTS")

if test_all and specific_test:
print(f"WARNING: can't have both TEST_ALL and SPECIFIC_TEST at the same time...")
print(f"Running TEST_ALL instead")
specific_test = ""

print("========================================")
print(f"db: {db}")
print(f"workspace: {workspace_name}")
print(f"test_workflows: {test_workflows}")
print(f"test_all: {test_all}")
print(f"specific_test: {specific_test}")
print(f"skip_tests: {skip_tests}")
print("========================================")

Expand Down Expand Up @@ -224,6 +231,7 @@ def download_files(force_redownload=False):
modal.Image.debian_slim(python_version="3.11")
.env({"COMFYUI_PATH": "/root", "COMFYUI_MODEL_PATH": "/root/models"})
.env({"TEST_ALL": os.getenv("TEST_ALL")})
.env({"SPECIFIC_TEST": os.getenv("SPECIFIC_TEST")})
.apt_install("git", "git-lfs", "libgl1-mesa-glx", "libglib2.0-0", "libmagic1", "ffmpeg", "libegl1")
.pip_install_from_pyproject(str(root_dir / "pyproject.toml"))
.pip_install("diffusers==0.31.0")
Expand Down Expand Up @@ -319,10 +327,11 @@ def downloads(self):

@modal.build()
def test_workflows(self):
print(" ==== TESTING WORKFLOWS ====")
if os.getenv("SKIP_TESTS"):
print("Skipping tests")
return

print(" ==== TESTING WORKFLOWS ====")

t1 = time.time()
self._start()
Expand All @@ -348,6 +357,8 @@ def test_workflows(self):
test_all = os.getenv("TEST_ALL", False)
if test_all:
tests = glob.glob(f"/root/workspace/workflows/{workflow}/test*.json")
elif specific_test:
tests = [f"/root/workspace/workflows/{workflow}/{specific_test}"]
else:
tests = [f"/root/workspace/workflows/{workflow}/test.json"]
print(f"====> Running tests for {workflow}: ", tests)
Expand Down

0 comments on commit 38fe432

Please sign in to comment.