From 7be37df3e4a7c0a733703045e26ec36c9513a242 Mon Sep 17 00:00:00 2001 From: tegwick Date: Wed, 17 Dec 2025 12:10:25 +0100 Subject: [PATCH] fix: resolve pytest warnings for test_workspace functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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 --- tests/test_issue_145_production_error_handler.py | 9 +++------ tests/test_utils.py | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/tests/test_issue_145_production_error_handler.py b/tests/test_issue_145_production_error_handler.py index 34925ea5..e5f7e238 100644 --- a/tests/test_issue_145_production_error_handler.py +++ b/tests/test_issue_145_production_error_handler.py @@ -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 diff --git a/tests/test_utils.py b/tests/test_utils.py index eeecdb7e..b63a9484 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -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: