Skip to content

Commit

Permalink
Python repro for issue nv-morpheus#360
Browse files Browse the repository at this point in the history
  • Loading branch information
dagardner-nv committed Sep 26, 2023
1 parent 743d4d3 commit dfa066e
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion python/tests/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
# from functools import partial

# import numpy as np
# import pytest

import pytest

import mrc
import mrc.tests.test_edges_cpp as m
Expand Down Expand Up @@ -445,9 +446,50 @@ def on_complete():
executor.join()


def test_segment_init_error():
"""
Test for issue #360
"""

def gen_data():
yield 1

def init1(builder: mrc.Builder):
source = builder.make_source("source", gen_data)
egress = builder.get_egress("b")
builder.make_edge(source, egress)

def init2(builder: mrc.Builder):

def on_next(input):
pass

ingress = builder.get_ingress("b")
sink = builder.make_sink("sink", on_next)

builder.make_edge(ingress, sink)
raise RuntimeError("Test for #360")

pipe = mrc.Pipeline()

pipe.make_segment("TestSegment11", [], [("b", int, False)], init1)
pipe.make_segment("TestSegment22", [("b", int, False)], [], init2)

options = mrc.Options()

executor = mrc.Executor(options)
executor.register_pipeline(pipe)

with pytest.raises(RuntimeError):
executor.start()

executor.join()


if (__name__ in ("__main__", )):
test_dynamic_port_creation_good()
test_dynamic_port_creation_bad()
test_ingress_egress_custom_type_construction()
test_dynamic_port_get_ingress_egress()
test_dynamic_port_with_type_get_ingress_egress()
test_segment_init_error()

0 comments on commit dfa066e

Please sign in to comment.