Skip to content

Commit

Permalink
added assert to test_compile. Might still be a bit fragile
Browse files Browse the repository at this point in the history
  • Loading branch information
telamonian committed Aug 13, 2024
1 parent 2825212 commit 4295769
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
20 changes: 20 additions & 0 deletions tests/uv/mock_requirements/requirements.compiled
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This file was autogenerated by uv via the following command:
# uv pip compile /home/tel/git/comfy-cli/tests/uv/mock_requirements/core_reqs.txt /home/tel/git/comfy-cli/tests/uv/mock_requirements/x_reqs.txt /home/tel/git/comfy-cli/tests/uv/mock_requirements/y_reqs.txt --index-strategy unsafe-best-match --override /home/tel/git/comfy-cli/tests/temp/test_uv/override.txt -o /home/tel/git/comfy-cli/tests/temp/test_uv/requirements.compiled
mpmath==1.3.0
# via sympy
numpy==2.0.1
# via
# --override override.txt
# -r /home/tel/git/comfy-cli/tests/uv/mock_requirements/x_reqs.txt
# -r /home/tel/git/comfy-cli/tests/uv/mock_requirements/y_reqs.txt
sympy==1.13.2
# via
# --override override.txt
# -r /home/tel/git/comfy-cli/tests/uv/mock_requirements/x_reqs.txt
# -r /home/tel/git/comfy-cli/tests/uv/mock_requirements/y_reqs.txt
tqdm==4.66.4
# via
# --override override.txt
# -r /home/tel/git/comfy-cli/tests/uv/mock_requirements/core_reqs.txt
# -r /home/tel/git/comfy-cli/tests/uv/mock_requirements/x_reqs.txt
# -r /home/tel/git/comfy-cli/tests/uv/mock_requirements/y_reqs.txt
15 changes: 9 additions & 6 deletions tests/uv/test_uv.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from itertools import cycle
from pathlib import Path
import pytest
import shutil
Expand All @@ -7,8 +6,11 @@
from comfy_cli import ui

hereDir = Path(__file__).parent.resolve()
reqsDir = hereDir/"mock_requirements"

# set up a temp dir to write files to
testsDir = hereDir.parent.resolve()
temp = testsDir / "temp" / "test_uv"
temp = testsDir/"temp"/"test_uv"
shutil.rmtree(temp, ignore_errors=True)
temp.mkdir(exist_ok=True, parents=True)

Expand All @@ -23,12 +25,13 @@ def _mock_prompt_select(*args, **kwargs):
def test_compile(mock_prompt_select):
depComp = DependencyCompiler(
cwd=temp,
reqFilesCore=[hereDir/"mock_requirements/core_reqs.txt"],
reqFilesExt=[hereDir/"mock_requirements/x_reqs.txt", hereDir/"mock_requirements/y_reqs.txt"],
reqFilesCore=[reqsDir/"core_reqs.txt"],
reqFilesExt=[reqsDir/"x_reqs.txt", reqsDir/"y_reqs.txt"],
)

depComp.makeOverride()
depComp.compileCorePlusExt()

if __name__ == "__main__":
test_compile()
with open(reqsDir/"requirements.compiled", "r") as known, open(temp/"requirements.compiled", "r") as test:
knownLines, testLines = known.readlines(), test.readlines()
assert knownLines == testLines

0 comments on commit 4295769

Please sign in to comment.