File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed
Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -44,9 +44,12 @@ def test_unsafe_workspace_outside_base_dir(self):
4444 def test_workspace_in_temp_dir_allowed (self ):
4545 """Test workspace in temp directory is allowed."""
4646 import tempfile
47- temp_workspace = Path (tempfile .gettempdir ()) / "test_workspace"
48-
49- assert self .backend ._is_safe_workspace (temp_workspace )
47+ temp_workspace = Path (tempfile .gettempdir ()) / "test_workspace_mg"
48+ temp_workspace .mkdir (exist_ok = True )
49+ try :
50+ assert self .backend ._is_safe_workspace (temp_workspace )
51+ finally :
52+ temp_workspace .rmdir ()
5053
5154 def test_nonexistent_workspace_rejected (self ):
5255 """Test non-existent workspace is rejected."""
Original file line number Diff line number Diff line change @@ -229,14 +229,15 @@ async def test_render_unsafe_workspace(self):
229229
230230 def test_is_safe_workspace (self ):
231231 """Test workspace safety validation."""
232- # Valid workspace
233- valid_workspace = Path ("/tmp/test_workspace" )
234- assert self .backend ._is_safe_workspace (valid_workspace ) is True
235-
236232 # Test with actual path that exists
237233 with tempfile .TemporaryDirectory () as tmpdir :
238234 workspace = Path (tmpdir )
239235 assert self .backend ._is_safe_workspace (workspace ) is True
236+
237+ # Test with subdirectory that exists
238+ sub_workspace = Path (tmpdir ) / "test_workspace"
239+ sub_workspace .mkdir ()
240+ assert self .backend ._is_safe_workspace (sub_workspace ) is True
240241
241242 def test_get_crf_for_quality (self ):
242243 """Test CRF value mapping for quality settings."""
You can’t perform that action at this time.
0 commit comments