fix: isolate additional test files from production asset registry
Some checks failed
Test Suite / unit-tests (3.11) (push) Has been cancelled
Test Suite / unit-tests (3.12) (push) Has been cancelled
Test Suite / integration-tests (push) Has been cancelled
Test Suite / e2e-tests (push) Has been cancelled
Test Suite / performance-tests (push) Has been cancelled
Test Suite / code-quality (push) Has been cancelled
Test Suite / security-scan (push) Has been cancelled
Test Suite / test-summary (push) Has been cancelled
Some checks failed
Test Suite / unit-tests (3.11) (push) Has been cancelled
Test Suite / unit-tests (3.12) (push) Has been cancelled
Test Suite / integration-tests (push) Has been cancelled
Test Suite / e2e-tests (push) Has been cancelled
Test Suite / performance-tests (push) Has been cancelled
Test Suite / code-quality (push) Has been cancelled
Test Suite / security-scan (push) Has been cancelled
Test Suite / test-summary (push) Has been cancelled
- Fix test_issue_144_auto_discovery_workspace.py to use isolated test workspace - Fix test_issue_144_asset_optimization.py to use isolated test workspace - Ensure all AssetManager instances use test-specific registry paths - Prevent additional test artifacts from contaminating production registry 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -8,8 +8,6 @@ Issue #144: Phase 3 - Advanced Features and Performance
|
||||
"""
|
||||
|
||||
import pytest
|
||||
import tempfile
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
from unittest.mock import Mock, patch, MagicMock
|
||||
import json
|
||||
@@ -21,6 +19,7 @@ from markitect.assets.optimizer import AssetOptimizer, OptimizationProfile, Opti
|
||||
from markitect.assets.optimizer import AssetTransformer as OptimizerTransformer
|
||||
from markitect.assets.transformer import AssetTransformer, ThumbnailGenerator
|
||||
from markitect.assets.analyzer import ContentAnalyzer, SimilarityDetector, AssetMetricsCollector
|
||||
from tests.test_utils import create_test_workspace, get_test_asset_config
|
||||
|
||||
|
||||
class TestAssetOptimizationAndProcessing:
|
||||
@@ -28,9 +27,9 @@ class TestAssetOptimizationAndProcessing:
|
||||
|
||||
def setup_method(self):
|
||||
"""Set up test environment with sample assets."""
|
||||
self.temp_dir = tempfile.mkdtemp()
|
||||
self.assets_dir = Path(self.temp_dir) / "assets"
|
||||
self.test_files_dir = Path(self.temp_dir) / "test_files"
|
||||
self.temp_dir = create_test_workspace("asset_optimization")
|
||||
self.assets_dir = self.temp_dir / "assets"
|
||||
self.test_files_dir = self.temp_dir / "test_files"
|
||||
|
||||
self.assets_dir.mkdir()
|
||||
self.test_files_dir.mkdir()
|
||||
@@ -39,11 +38,14 @@ class TestAssetOptimizationAndProcessing:
|
||||
self.create_test_images()
|
||||
self.create_test_documents()
|
||||
|
||||
self.asset_manager = AssetManager(storage_path=self.assets_dir)
|
||||
# Use test asset configuration to ensure isolated registry
|
||||
config = get_test_asset_config(self.temp_dir)
|
||||
self.asset_manager = AssetManager(config)
|
||||
|
||||
def teardown_method(self):
|
||||
"""Clean up temporary directories."""
|
||||
shutil.rmtree(self.temp_dir)
|
||||
import shutil
|
||||
shutil.rmtree(self.temp_dir, ignore_errors=True)
|
||||
|
||||
def create_test_images(self):
|
||||
"""Create test images with various properties."""
|
||||
|
||||
@@ -8,8 +8,6 @@ Issue #144: Phase 3 - Advanced Features and Performance
|
||||
"""
|
||||
|
||||
import pytest
|
||||
import tempfile
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
from unittest.mock import Mock, patch, MagicMock
|
||||
import json
|
||||
@@ -19,6 +17,7 @@ from markitect.assets import AssetManager
|
||||
from markitect.assets.discovery import AssetDiscoveryEngine, MarkdownScanner, AssetReference
|
||||
from markitect.workspace import WorkspaceManager, WorkspaceTemplate
|
||||
from markitect.assets.analytics import AssetAnalytics, UsageReport
|
||||
from tests.test_utils import create_test_workspace, get_test_asset_config
|
||||
|
||||
|
||||
class TestAutoDiscoveryAndWorkspace:
|
||||
@@ -26,8 +25,8 @@ class TestAutoDiscoveryAndWorkspace:
|
||||
|
||||
def setup_method(self):
|
||||
"""Set up test environment with sample markdown files and workspace."""
|
||||
self.temp_dir = tempfile.mkdtemp()
|
||||
self.project_dir = Path(self.temp_dir) / "test_project"
|
||||
self.temp_dir = create_test_workspace("auto_discovery")
|
||||
self.project_dir = self.temp_dir / "test_project"
|
||||
self.assets_dir = self.project_dir / "assets"
|
||||
self.docs_dir = self.project_dir / "docs"
|
||||
|
||||
@@ -38,11 +37,14 @@ class TestAutoDiscoveryAndWorkspace:
|
||||
self.create_test_markdown_files()
|
||||
self.create_test_assets()
|
||||
|
||||
self.asset_manager = AssetManager(storage_path=self.assets_dir)
|
||||
# Use test asset configuration to ensure isolated registry
|
||||
config = get_test_asset_config(self.temp_dir)
|
||||
self.asset_manager = AssetManager(config)
|
||||
|
||||
def teardown_method(self):
|
||||
"""Clean up temporary directories."""
|
||||
shutil.rmtree(self.temp_dir)
|
||||
import shutil
|
||||
shutil.rmtree(self.temp_dir, ignore_errors=True)
|
||||
|
||||
def create_test_markdown_files(self):
|
||||
"""Create test markdown files with various asset references."""
|
||||
|
||||
Reference in New Issue
Block a user