From ee6f0cc1d598e6cd8d859c4a71452e02858aaeca Mon Sep 17 00:00:00 2001 From: telamonian Date: Tue, 27 Aug 2024 02:21:41 -0400 Subject: [PATCH] fix `DependencyCompiler` unittest --- tests/uv/mock_requirements/requirements.compiled | 9 ++++++++- tests/uv/test_uv.py | 10 ++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/tests/uv/mock_requirements/requirements.compiled b/tests/uv/mock_requirements/requirements.compiled index 2ff3d84..1750223 100644 --- a/tests/uv/mock_requirements/requirements.compiled +++ b/tests/uv/mock_requirements/requirements.compiled @@ -1,22 +1,29 @@ # 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 +# 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 --emit-index-annotation --emit-index-url --index-strategy unsafe-best-match -o /home/tel/git/comfy-cli/tests/temp/test_uv/requirements.compiled --override /home/tel/git/comfy-cli/tests/temp/test_uv/override.txt +--index-url https://pypi.org/simple +--extra-index-url https://download.pytorch.org/whl/rocm6.1 + mpmath==1.3.0 # via # -r /home/tel/git/comfy-cli/tests/uv/mock_requirements/y_reqs.txt # sympy + # from https://download.pytorch.org/whl/rocm6.1 numpy==2.0.0 # 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 + # from https://pypi.org/simple sympy==1.13.0 # 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 + # from https://pypi.org/simple 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 + # from https://pypi.org/simple diff --git a/tests/uv/test_uv.py b/tests/uv/test_uv.py index 307b3f9..35f4727 100644 --- a/tests/uv/test_uv.py +++ b/tests/uv/test_uv.py @@ -37,10 +37,16 @@ def test_compile(mock_prompt_select): depComp.make_override() depComp.compile_core_plus_ext() + with open(reqsDir / "requirements.compiled", "r") as known, open(temp / "requirements.compiled", "r") as test: + for line in known.read(): + print(line) + for line in test.read(): + print(line) + with open(reqsDir / "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 line.strip()[0] != "#"], - [line for line in test.readlines() if line.strip()[0] != "#"], + [line for line in known.readlines() if not line.strip().startswith("#")], + [line for line in test.readlines() if not line.strip().startswith("#")], ] assert knownLines == testLines