Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yczhang-nv committed Nov 6, 2024
1 parent 279df4a commit 06e72ec
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 27 deletions.
20 changes: 0 additions & 20 deletions tests/morpheus/pipeline/test_error_pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,3 @@ def test_stage_raises_exception(config: Config, filter_probs_df: DataFrameType,
# Ensure that the raised exception was from our stage and not from something else
assert error_raiser_stage.error_raised
assert len(sink_stage.get_messages()) == 0


@pytest.mark.gpu_and_cpu_mode
@pytest.mark.parametrize("delayed_start", [False, True])
def test_monitor_not_impl(config: Config, delayed_start: bool):

class UnsupportedType:
pass

pipe = LinearPipeline(config)
pipe.set_source(InMemSourceXStage(config, [UnsupportedType()]))
monitor_stage = pipe.add_stage(MonitorStage(config, log_level=logging.WARNING, delayed_start=delayed_start))
sink_stage = pipe.add_stage(InMemorySinkStage(config))

assert monitor_stage._mc.is_enabled()

with pytest.raises(NotImplementedError):
pipe.run()

assert len(sink_stage.get_messages()) == 0
10 changes: 5 additions & 5 deletions tests/morpheus/stages/test_monitor_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def two_x(x):
assert stage._mc._determine_count_fn is two_x


@pytest.mark.use_python
@pytest.mark.cpu_mode
@mock.patch('morpheus.controllers.monitor_controller.MorpheusTqdm')
def test_start_async(mock_morph_tqdm: mock.MagicMock, config: Config):
mock_morph_tqdm.return_value = mock_morph_tqdm
Expand All @@ -73,7 +73,7 @@ def test_start_async(mock_morph_tqdm: mock.MagicMock, config: Config):
assert stage._mc._progress is mock_morph_tqdm


@pytest.mark.use_python
@pytest.mark.cpu_mode
@mock.patch('morpheus.controllers.monitor_controller.MorpheusTqdm')
async def test_join(mock_morph_tqdm: mock.MagicMock, config: Config):
mock_morph_tqdm.return_value = mock_morph_tqdm
Expand All @@ -90,7 +90,7 @@ async def test_join(mock_morph_tqdm: mock.MagicMock, config: Config):
mock_morph_tqdm.close.assert_called_once()


@pytest.mark.use_python
@pytest.mark.cpu_mode
@mock.patch('morpheus.controllers.monitor_controller.MorpheusTqdm')
def test_refresh(mock_morph_tqdm: mock.MagicMock, config: Config):
mock_morph_tqdm.return_value = mock_morph_tqdm
Expand Down Expand Up @@ -154,7 +154,7 @@ def test_progress_sink(mock_morph_tqdm: mock.MagicMock, config: Config):
mock_morph_tqdm.update.assert_called_once_with(n=12)


@pytest.mark.use_python
@pytest.mark.cpu_mode
@pytest.mark.usefixtures("reset_loglevel")
@pytest.mark.parametrize('log_level', [logging.CRITICAL, logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG])
@mock.patch('morpheus.stages.general.monitor_stage.MonitorController.sink_on_completed', autospec=True)
Expand Down Expand Up @@ -183,7 +183,7 @@ def test_log_level(mock_progress_sink: mock.MagicMock,
assert mock_sink_on_completed.call_count == expected_call_count


@pytest.mark.gpu_and_cpu_mode
@pytest.mark.cpu_mode
def test_thread(config: Config, morpheus_log_level: int):
"""
Test ensures the monitor stage executes on the same thread as the parent stage
Expand Down
3 changes: 1 addition & 2 deletions tests/test_monitor_stage_pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ def sample_message_meta_generator(df_rows: int, df_cols: int, count: int) -> Gen
yield meta


@pytest.mark.use_cudf
@pytest.mark.usefixtures("use_cpp")
@pytest.mark.gpu_mode
def test_cpp_monitor_stage_pipe(config):
config.num_threads = 1

Expand Down

0 comments on commit 06e72ec

Please sign in to comment.