Skip to content

Commit 9d83a83

Browse files
committed
Fix unit test failures
1 parent d065330 commit 9d83a83

2 files changed

Lines changed: 17 additions & 28 deletions

File tree

sagemaker-mlops/tests/unit/sagemaker/mlops/feature_store/test_dataset_builder.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,9 @@ def test_create_with_dataframe_requires_identifiers(self, mock_session):
332332
class TestDatasetBuilderValidation:
333333
@pytest.fixture
334334
def mock_session(self):
335-
return Mock()
335+
session = Mock()
336+
session.sagemaker_config = {}
337+
return session
336338

337339
def test_to_csv_raises_for_invalid_base(self, mock_session):
338340
builder = DatasetBuilder(

sagemaker-mlops/tests/unit/sagemaker/mlops/feature_store/test_ingestion_manager_pandas.py

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -299,38 +299,25 @@ def test_sync_with_single_process_single_worker_works(self, mock_fg_class):
299299
# Should not raise validation error
300300
manager.run(data_frame=df, wait=True)
301301

302-
def test_async_with_multiple_workers_no_validation_error(self):
303-
"""Test that wait=False with max_workers > 1 doesn't raise validation error."""
302+
@pytest.mark.parametrize("max_workers,max_processes", [
303+
(2, 1), # Multiple workers, single process
304+
(1, 2), # Single worker, multiple processes
305+
(2, 2), # Multiple workers and processes
306+
])
307+
@patch.object(IngestionManagerPandas, '_run_multi_process')
308+
def test_async_with_parallelism_no_validation_error(self, mock_run, max_workers, max_processes):
309+
"""Test that wait=False works with any parallelism configuration where max_workers > 1 OR max_processes > 1."""
304310
manager = IngestionManagerPandas(
305311
feature_group_name="test-fg",
306312
feature_definitions={"id": {"FeatureType": "String", "CollectionType": None}},
307-
max_workers=2,
308-
max_processes=1,
309-
)
310-
311-
df = pd.DataFrame({"id": ["1", "2", "3"]})
312-
313-
# Should not raise validation error (will fail on actual ingestion, but that's expected)
314-
with pytest.raises(Exception) as exc_info:
315-
manager.run(data_frame=df, wait=False)
316-
317-
# Make sure it's not the validation error
318-
assert "Async ingestion (wait=False)" not in str(exc_info.value)
319-
320-
def test_async_with_multiple_processes_no_validation_error(self):
321-
"""Test that wait=False with max_processes > 1 doesn't raise validation error."""
322-
manager = IngestionManagerPandas(
323-
feature_group_name="test-fg",
324-
feature_definitions={"id": {"FeatureType": "String", "CollectionType": None}},
325-
max_workers=1,
326-
max_processes=2,
313+
max_workers=max_workers,
314+
max_processes=max_processes,
327315
)
328316

329317
df = pd.DataFrame({"id": ["1", "2", "3"]})
330318

331-
# Should not raise validation error (will fail on actual ingestion, but that's expected)
332-
with pytest.raises(Exception) as exc_info:
333-
manager.run(data_frame=df, wait=False)
319+
# Should not raise validation error
320+
manager.run(data_frame=df, wait=False)
334321

335-
# Make sure it's not the validation error
336-
assert "Async ingestion (wait=False)" not in str(exc_info.value)
322+
# Verify it called the multi-process method (positive assertion)
323+
mock_run.assert_called_once()

0 commit comments

Comments
 (0)