ComfyUI-Manager/tests/common/pip_util/setup_test_env.sh
Dr.Lt.Data 2866193baf ● feat: Draft pip package policy management system (not yet integrated)
Add comprehensive pip dependency conflict resolution framework as draft implementation. This is self-contained and does not affect existing
ComfyUI Manager functionality.

Key components:
- pip_util.py with PipBatch class for policy-driven package management
- Lazy-loaded policy system supporting base + user overrides
- Multi-stage policy execution (uninstall → apply_first_match → apply_all_matches → restore)
- Conditional policies based on platform, installed packages, and ComfyUI version
- Comprehensive test suite covering edge cases, workflows, and platform scenarios
- Design and implementation documentation

Policy capabilities (draft):
- Package replacement (e.g., PIL → Pillow, opencv-python → opencv-contrib-python)
- Version pinning to prevent dependency conflicts
- Dependency protection during installations
- Platform-specific handling (Linux/Windows, GPU detection)
- Pre-removal and post-restoration workflows

Testing infrastructure:
- Pytest-based test suite with isolated environments
- Dependency analysis tools for conflict detection
- Coverage for policy priority, edge cases, and environment recovery

Status: Draft implementation complete, integration with manager workflows pending.
2025-10-04 08:55:59 +09:00

48 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# Setup script for pip_util integration tests
# Creates a test venv and installs base packages
set -e # Exit on error
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
VENV_DIR="$SCRIPT_DIR/test_venv"
echo "Setting up test environment for pip_util integration tests..."
# Remove existing venv if present
if [ -d "$VENV_DIR" ]; then
echo "Removing existing test venv..."
rm -rf "$VENV_DIR"
fi
# Create new venv
echo "Creating test venv at $VENV_DIR..."
python3 -m venv "$VENV_DIR"
# Activate venv
source "$VENV_DIR/bin/activate"
# Upgrade pip
echo "Upgrading pip..."
pip install --upgrade pip
# Install pytest
echo "Installing pytest..."
pip install pytest
# Install base test packages
echo "Installing base test packages..."
pip install -r "$SCRIPT_DIR/requirements-test-base.txt"
echo ""
echo "Test environment setup complete!"
echo "Installed packages:"
pip freeze
echo ""
echo "To activate the test venv, run:"
echo " source $VENV_DIR/bin/activate"
echo ""
echo "To run tests:"
echo " pytest -v"