fix: resolve pytest warnings for test_workspace functions
Fixed pytest warnings where context manager functions were incorrectly identified as test functions because their names started with 'test_'. Changes: - Renamed test_workspace() to workspace_context() in test_utils.py - Updated import in test_issue_145_production_error_handler.py - Updated usage in temp_workspace fixture This eliminates 2 warnings: PytestReturnNotNoneWarning: Test functions should return None, but test_workspace returned <class 'contextlib._GeneratorContextManager'> Test Results: - Before: 1,160 passed, 0 failed, 38 skipped, 2 warnings - After: 1,158 passed, 0 failed, 38 skipped, 0 warnings Note: Test count decreased by 2 because the misnamed functions are no longer being collected as tests (which is correct behavior). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,7 +20,7 @@ from markitect.production.error_handler import (
|
|||||||
ResourceExhaustionError
|
ResourceExhaustionError
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
from .test_utils import test_workspace
|
from .test_utils import workspace_context
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# Fallback for missing test utilities
|
# Fallback for missing test utilities
|
||||||
import tempfile
|
import tempfile
|
||||||
@@ -29,16 +29,13 @@ except ImportError:
|
|||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def _test_workspace_fallback(name=None):
|
def workspace_context(name=None):
|
||||||
temp_dir = Path(tempfile.mkdtemp(prefix=f"{name}_" if name else "test_"))
|
temp_dir = Path(tempfile.mkdtemp(prefix=f"{name}_" if name else "test_"))
|
||||||
try:
|
try:
|
||||||
yield temp_dir
|
yield temp_dir
|
||||||
finally:
|
finally:
|
||||||
shutil.rmtree(temp_dir, ignore_errors=True)
|
shutil.rmtree(temp_dir, ignore_errors=True)
|
||||||
|
|
||||||
# Assign to expected name
|
|
||||||
test_workspace = _test_workspace_fallback
|
|
||||||
|
|
||||||
|
|
||||||
class TestProductionErrorHandler:
|
class TestProductionErrorHandler:
|
||||||
"""Test production error handling and recovery capabilities."""
|
"""Test production error handling and recovery capabilities."""
|
||||||
@@ -46,7 +43,7 @@ class TestProductionErrorHandler:
|
|||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def temp_workspace(self):
|
def temp_workspace(self):
|
||||||
"""Create temporary workspace for testing."""
|
"""Create temporary workspace for testing."""
|
||||||
with test_workspace("error_handler") as temp_dir:
|
with workspace_context("error_handler") as temp_dir:
|
||||||
yield temp_dir
|
yield temp_dir
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ def create_test_workspace(prefix: str = "test") -> Path:
|
|||||||
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def test_workspace(prefix: str = "test"):
|
def workspace_context(prefix: str = "test"):
|
||||||
"""Context manager for test workspace that auto-cleans up.
|
"""Context manager for test workspace that auto-cleans up.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
|||||||
Reference in New Issue
Block a user