diff --git a/tests/uv/mock_comfy/custom_nodes/x/pyproject.toml b/tests/uv/mock_comfy/custom_nodes/x/pyproject.toml new file mode 100644 index 00000000..e69de29b diff --git a/tests/uv/mock_comfy/custom_nodes/x/requirements.txt b/tests/uv/mock_comfy/custom_nodes/x/requirements.txt new file mode 100644 index 00000000..e69de29b diff --git a/tests/uv/mock_comfy/custom_nodes/x/setup.cfg b/tests/uv/mock_comfy/custom_nodes/x/setup.cfg new file mode 100644 index 00000000..e69de29b diff --git a/tests/uv/mock_comfy/custom_nodes/x/setup.py b/tests/uv/mock_comfy/custom_nodes/x/setup.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/uv/mock_comfy/custom_nodes/y/setup.cfg b/tests/uv/mock_comfy/custom_nodes/y/setup.cfg new file mode 100644 index 00000000..e69de29b diff --git a/tests/uv/mock_comfy/custom_nodes/y/setup.py b/tests/uv/mock_comfy/custom_nodes/y/setup.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/uv/mock_comfy/custom_nodes/z/setup.py b/tests/uv/mock_comfy/custom_nodes/z/setup.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/uv/mock_comfy/pyproject.toml b/tests/uv/mock_comfy/pyproject.toml new file mode 100644 index 00000000..e69de29b diff --git a/tests/uv/mock_comfy/setup.cfg b/tests/uv/mock_comfy/setup.cfg new file mode 100644 index 00000000..e69de29b diff --git a/tests/uv/mock_comfy/setup.py b/tests/uv/mock_comfy/setup.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/uv/test_uv.py b/tests/uv/test_uv.py index 25d1bff5..abba31f3 100644 --- a/tests/uv/test_uv.py +++ b/tests/uv/test_uv.py @@ -8,7 +8,8 @@ from comfy_cli.uv import DependencyCompiler hereDir = Path(__file__).parent.resolve() -reqsDir = hereDir / "mock_requirements" +mockComfyDir = hereDir / "mock_comfy" +mockReqsDir = hereDir / "mock_requirements" # set up a temp dir to write files to testsDir = hereDir.parent.resolve() @@ -27,19 +28,40 @@ def _mock_prompt_select(*args, **kwargs): monkeypatch.setattr(ui, "prompt_select", _mock_prompt_select) +def test_find_req_files(): + mockNodesDir = mockComfyDir / "custom_nodes" + + knownReqFilesCore = [mockComfyDir / "pyproject.toml"] + knownReqFilesExt = sorted( + [ + mockNodesDir / "x" / "requirements.txt", + mockNodesDir / "y" / "setup.cfg", + mockNodesDir / "z" / "setup.py", + ] + ) + + depComp = DependencyCompiler(cwd=mockComfyDir) + + testReqFilesCore = depComp.reqFilesCore + testReqFilesExt = sorted(depComp.reqFilesExt) + + assert knownReqFilesCore == testReqFilesCore + assert knownReqFilesExt == testReqFilesExt + + def test_compile(mock_prompt_select): depComp = DependencyCompiler( cwd=temp, gpu=GPU_OPTION.AMD, outDir=temp, - reqFilesCore=[reqsDir / "core_reqs.txt"], - reqFilesExt=[reqsDir / "x_reqs.txt", reqsDir / "y_reqs.txt"], + reqFilesCore=[mockReqsDir / "core_reqs.txt"], + reqFilesExt=[mockReqsDir / "x_reqs.txt", mockReqsDir / "y_reqs.txt"], ) depComp.make_override() depComp.compile_core_plus_ext() - with open(reqsDir / "requirements.compiled", "r") as known, open(temp / "requirements.compiled", "r") as test: + with open(mockReqsDir / "requirements.compiled", "r") as known, open(temp / "requirements.compiled", "r") as test: # compare all non-commented lines in generated file vs reference file knownLines, testLines = [ [line for line in known.readlines() if not line.strip().startswith("#")],