refactor: remove package-level caching to support dynamic installation
Remove package-level caching in cnr_utils and node_package modules to enable proper dynamic custom node installation and version switching without ComfyUI server restarts. Key Changes: - Remove @lru_cache decorators from version-sensitive functions - Remove cached_property from NodePackage for dynamic state updates - Add comprehensive test suite with parallel execution support - Implement version switching tests (CNR ↔ Nightly) - Add case sensitivity integration tests - Improve error handling and logging API Priority Rules (manager_core.py:1801): - Enabled-Priority: Show only enabled version when both exist - CNR-Priority: Show only CNR when both CNR and Nightly are disabled - Prevents duplicate package entries in /v2/customnode/installed API - Cross-match using cnr_id and aux_id for CNR ↔ Nightly detection Test Infrastructure: - 8 test files with 59 comprehensive test cases - Parallel test execution across 5 isolated environments - Automated test scripts with environment setup - Configurable timeout (60 minutes default) - Support for both master and dr-support-pip-cm branches Bug Fixes: - Fix COMFYUI_CUSTOM_NODES_PATH environment variable export - Resolve test fixture regression with module-level variables - Fix import timing issues in test configuration - Register pytest integration marker to eliminate warnings - Fix POSIX compliance in shell scripts (((var++)) → $((var + 1))) Documentation: - CNR_VERSION_MANAGEMENT_DESIGN.md v1.0 → v1.1 with API priority rules - Add test guides and execution documentation (TESTING_PROMPT.md) - Add security-enhanced installation guide - Create CLI migration guides and references - Document package version management 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
101
tests/update_test_durations.sh
Executable file
101
tests/update_test_durations.sh
Executable file
@@ -0,0 +1,101 @@
|
||||
#!/bin/bash
|
||||
# Update test durations for optimal parallel distribution
|
||||
# Run this when tests are added/modified/removed
|
||||
|
||||
set -e
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m'
|
||||
|
||||
echo -e "${BLUE}========================================${NC}"
|
||||
echo -e "${BLUE}Test Duration Update${NC}"
|
||||
echo -e "${BLUE}========================================${NC}"
|
||||
echo ""
|
||||
|
||||
# Check if virtual environment is activated
|
||||
if [ -z "$VIRTUAL_ENV" ]; then
|
||||
echo -e "${YELLOW}Activating virtual environment...${NC}"
|
||||
source ~/venv/bin/activate
|
||||
fi
|
||||
|
||||
# Project root
|
||||
cd /mnt/teratera/git/comfyui-manager
|
||||
|
||||
# Clean up
|
||||
echo -e "${YELLOW}Cleaning up processes and cache...${NC}"
|
||||
pkill -f "ComfyUI/main.py" 2>/dev/null || true
|
||||
sleep 2
|
||||
|
||||
find comfyui_manager -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
|
||||
find tests -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
|
||||
|
||||
# Reinstall package
|
||||
echo -e "${YELLOW}Reinstalling package...${NC}"
|
||||
if command -v uv &> /dev/null; then
|
||||
uv pip install . > /dev/null
|
||||
else
|
||||
pip install . > /dev/null
|
||||
fi
|
||||
|
||||
# Start test server
|
||||
echo -e "${YELLOW}Starting test server...${NC}"
|
||||
cd tests/env/ComfyUI_1
|
||||
|
||||
nohup python main.py \
|
||||
--enable-manager \
|
||||
--enable-compress-response-body \
|
||||
--front-end-root front \
|
||||
--port 8188 \
|
||||
> /tmp/duration-update-server.log 2>&1 &
|
||||
|
||||
SERVER_PID=$!
|
||||
cd - > /dev/null
|
||||
|
||||
# Wait for server
|
||||
echo -e "${YELLOW}Waiting for server to be ready...${NC}"
|
||||
for i in {1..30}; do
|
||||
if curl -s "http://127.0.0.1:8188/system_stats" > /dev/null 2>&1; then
|
||||
echo -e "${GREEN}✓ Server ready${NC}"
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
echo -ne "."
|
||||
done
|
||||
echo ""
|
||||
|
||||
# Run tests to collect durations
|
||||
echo -e "${YELLOW}Running tests to collect duration data...${NC}"
|
||||
echo -e "${YELLOW}This may take 15-20 minutes...${NC}"
|
||||
|
||||
pytest tests/glob/ tests/test_case_sensitivity_integration.py \
|
||||
--store-durations \
|
||||
--durations-path=tests/.test_durations \
|
||||
-v \
|
||||
--tb=short \
|
||||
> /tmp/duration-update.log 2>&1
|
||||
|
||||
EXIT_CODE=$?
|
||||
|
||||
# Stop server
|
||||
pkill -f "ComfyUI/main.py" 2>/dev/null || true
|
||||
sleep 2
|
||||
|
||||
if [ $EXIT_CODE -eq 0 ]; then
|
||||
echo -e "${GREEN}========================================${NC}"
|
||||
echo -e "${GREEN}✓ Duration data updated successfully${NC}"
|
||||
echo -e "${GREEN}========================================${NC}"
|
||||
echo ""
|
||||
echo -e "Updated file: ${BLUE}tests/.test_durations${NC}"
|
||||
echo -e "Test count: $(jq 'length' tests/.test_durations 2>/dev/null || echo 'N/A')"
|
||||
echo ""
|
||||
echo -e "${YELLOW}Commit the updated .test_durations file:${NC}"
|
||||
echo -e " git add tests/.test_durations"
|
||||
echo -e " git commit -m 'chore: update test duration data'"
|
||||
else
|
||||
echo -e "${RED}✗ Failed to update duration data${NC}"
|
||||
echo -e "${YELLOW}Check log: /tmp/duration-update.log${NC}"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user