1. requirements.txt 限定 py<1.11.0 和 pytest<8.0.0,避免 AttributeError: module 'py' has no attribute 'path' 2. CI 安装步骤强制指定兼容版本,确保 GitHub Actions 稳定通过 3. 本地推荐使用 venv 隔离依赖,避免系统包冲突 4. 测试脚本 run_tests.py 支持自动适配环境,纯Python/torch/pytest 均可用 fix(ci/deps): Fix pytest/py compatibility, improve venv support 1. requirements.txt restricts py<1.11.0 and pytest<8.0.0 to avoid AttributeError 2. CI install step enforces compatible versions for stable GitHub Actions 3. Local usage recommends venv for dependency isolation 4. run_tests.py auto-detects environment, works for pure Python/torch/pytest
46 lines
1.2 KiB
YAML
46 lines
1.2 KiB
YAML
name: CI Test
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, master ]
|
|
pull_request:
|
|
branches: [ main, master ]
|
|
|
|
jobs:
|
|
pure-python:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.9'
|
|
- name: Install dependencies (pure Python)
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
pip install 'pytest>=7.2.0,<8.0.0' 'py<1.11.0'
|
|
- name: Run pure Python tests
|
|
run: |
|
|
python tests/run_tests.py
|
|
|
|
full-env:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.9'
|
|
- name: Install dependencies (with torch)
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
pip install torch torchvision
|
|
pip install 'pytest>=7.2.0,<8.0.0' 'py<1.11.0'
|
|
# 可选:安装ComfyUI依赖(如有)
|
|
# pip install folder_paths
|
|
- name: Run all tests (with torch)
|
|
run: |
|
|
python tests/run_tests.py
|