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:
2025-12-17 12:10:25 +01:00
parent 21189f7664
commit 7be37df3e4
2 changed files with 4 additions and 7 deletions

View File

@@ -20,7 +20,7 @@ from markitect.production.error_handler import (
ResourceExhaustionError
)
try:
from .test_utils import test_workspace
from .test_utils import workspace_context
except ImportError:
# Fallback for missing test utilities
import tempfile
@@ -29,16 +29,13 @@ except ImportError:
import shutil
@contextmanager
def _test_workspace_fallback(name=None):
def workspace_context(name=None):
temp_dir = Path(tempfile.mkdtemp(prefix=f"{name}_" if name else "test_"))
try:
yield temp_dir
finally:
shutil.rmtree(temp_dir, ignore_errors=True)
# Assign to expected name
test_workspace = _test_workspace_fallback
class TestProductionErrorHandler:
"""Test production error handling and recovery capabilities."""
@@ -46,7 +43,7 @@ class TestProductionErrorHandler:
@pytest.fixture
def temp_workspace(self):
"""Create temporary workspace for testing."""
with test_workspace("error_handler") as temp_dir:
with workspace_context("error_handler") as temp_dir:
yield temp_dir
@pytest.fixture

View File

@@ -38,7 +38,7 @@ def create_test_workspace(prefix: str = "test") -> Path:
@contextmanager
def test_workspace(prefix: str = "test"):
def workspace_context(prefix: str = "test"):
"""Context manager for test workspace that auto-cleans up.
Args: