test: tomli fallback for tomllib on py3.10 (CI matrix leg)
This commit is contained in:
@@ -56,8 +56,8 @@ jobs:
|
||||
# CPU wheel keeps the download ~200 MB instead of the CUDA one (~2.5 GB).
|
||||
python -m pip install torch --index-url https://download.pytorch.org/whl/cpu
|
||||
# numpy is a runtime dependency (src/rope.py) — torch wheels no
|
||||
# longer pull it in automatically.
|
||||
python -m pip install numpy pytest pytest-cov ruff
|
||||
# longer pull it in automatically. tomli backs tomllib on py3.10.
|
||||
python -m pip install numpy tomli pytest pytest-cov ruff
|
||||
|
||||
- name: Lint (ruff — correctness rules)
|
||||
# W3 scope decision (2026-08-25): CI gates the CORRECTNESS rule set
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ license = {file = "LICENSE"}
|
||||
dependencies = ["torch", "numpy"]
|
||||
|
||||
[project.optional-dependencies]
|
||||
test = ["pytest>=7.0", "pytest-cov>=4.0"]
|
||||
test = ["pytest>=7.0", "pytest-cov>=4.0", "tomli>=1.1.0; python_version < '3.11'"]
|
||||
|
||||
[project.urls]
|
||||
Repository = "https://github.com/wildminder/ComfyUI-DyPE"
|
||||
|
||||
+13
-16
@@ -5,6 +5,11 @@ import re
|
||||
|
||||
import pytest
|
||||
|
||||
try:
|
||||
import tomllib # Python >= 3.11
|
||||
except ModuleNotFoundError: # Python 3.10
|
||||
import tomli as tomllib
|
||||
|
||||
PROJECT_ROOT = pathlib.Path(__file__).parent.parent
|
||||
SRC_DIR = PROJECT_ROOT / "src"
|
||||
|
||||
@@ -104,34 +109,26 @@ class TestTypeAnnotations:
|
||||
|
||||
@pytest.mark.unit
|
||||
class TestPackaging:
|
||||
def _load_pyproject(self):
|
||||
with open(PROJECT_ROOT / "pyproject.toml", "rb") as f:
|
||||
return tomllib.load(f)
|
||||
|
||||
def test_pyproject_has_pytest_config(self):
|
||||
import tomllib
|
||||
pyproject = PROJECT_ROOT / "pyproject.toml"
|
||||
with open(pyproject, "rb") as f:
|
||||
data = tomllib.load(f)
|
||||
data = self._load_pyproject()
|
||||
assert "pytest" in data.get("tool", {})
|
||||
|
||||
def test_pyproject_has_markers(self):
|
||||
import tomllib
|
||||
pyproject = PROJECT_ROOT / "pyproject.toml"
|
||||
with open(pyproject, "rb") as f:
|
||||
data = tomllib.load(f)
|
||||
data = self._load_pyproject()
|
||||
markers = data["tool"]["pytest"]["ini_options"]["markers"]
|
||||
assert any("comfyui_integration" in m for m in markers)
|
||||
|
||||
def test_requires_comfyui_present(self):
|
||||
import tomllib
|
||||
pyproject = PROJECT_ROOT / "pyproject.toml"
|
||||
with open(pyproject, "rb") as f:
|
||||
data = tomllib.load(f)
|
||||
data = self._load_pyproject()
|
||||
tool_comfy = data.get("tool", {}).get("comfy", {})
|
||||
assert "requires-comfyui" in tool_comfy, "Missing requires-comfyui in [tool.comfy]"
|
||||
|
||||
def test_ruff_config_present(self):
|
||||
import tomllib
|
||||
pyproject = PROJECT_ROOT / "pyproject.toml"
|
||||
with open(pyproject, "rb") as f:
|
||||
data = tomllib.load(f)
|
||||
data = self._load_pyproject()
|
||||
assert "ruff" in data.get("tool", {}), "Missing [tool.ruff] in pyproject.toml"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user