Skip to content

Commit

Permalink
test: skip uneeded tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JoanFM committed Dec 19, 2024
1 parent a067a74 commit 413fa7b
Showing 1 changed file with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,71 +9,79 @@
cur_dir = os.path.dirname(os.path.abspath(__file__))


@pytest.mark.skipif("GITHUB_WORKFLOW" in os.environ, reason="Skip unneeded")git
def test_visualization_with_yml_file_img(tmpdir):
Flow.load_config(
os.path.join(cur_dir, '../../../yaml/test_flow_visualization.yml')
).plot(output=os.path.join(tmpdir, 'flow.svg'))
assert os.path.exists(os.path.join(tmpdir, 'flow.svg'))


@pytest.mark.skipif("GITHUB_WORKFLOW" in os.environ, reason="Skip unneeded")
def test_visualization_with_yml_file_jpg(tmpdir):
Flow.load_config(
os.path.join(cur_dir, '../../../yaml/test_flow_visualization.yml')
).plot(output=os.path.join(tmpdir, 'flow.jpg'))
assert os.path.exists(os.path.join(tmpdir, 'flow.jpg'))


@pytest.mark.skipif("GITHUB_WORKFLOW" in os.environ, reason="Skip unneeded")
def test_visualization_with_yml_file_jpg_lr(tmpdir):
Flow.load_config(
os.path.join(cur_dir, '../../../yaml/test_flow_visualization.yml')
).plot(output=os.path.join(tmpdir, 'flow-hor.jpg'), vertical_layout=False)
assert os.path.exists(os.path.join(tmpdir, 'flow-hor.jpg'))


@pytest.mark.skipif("GITHUB_WORKFLOW" in os.environ, reason="Skip unneeded")
def test_visualization_plot_twice(tmpdir):
(
Flow()
.add(name='pod_a')
.plot(output=os.path.join(tmpdir, 'flow1.svg'))
.add(name='pod_b', needs='gateway')
.needs(['pod_a', 'pod_b'])
.plot(output=os.path.join(tmpdir, 'flow2.svg'))
.add(name='pod_a')
.plot(output=os.path.join(tmpdir, 'flow1.svg'))
.add(name='pod_b', needs='gateway')
.needs(['pod_a', 'pod_b'])
.plot(output=os.path.join(tmpdir, 'flow2.svg'))
)

assert os.path.exists(os.path.join(tmpdir, 'flow1.svg'))
assert os.path.exists(os.path.join(tmpdir, 'flow2.svg'))


@pytest.mark.skipif("GITHUB_WORKFLOW" in os.environ, reason="Skip unneeded")
def test_visualization_plot_in_middle(tmpdir):
(
Flow()
.add(name='pod_a')
.plot(output=os.path.join(tmpdir, 'flow3.svg'))
.add(name='pod_b', needs='gateway')
.needs(['pod_a', 'pod_b'])
.add(name='pod_a')
.plot(output=os.path.join(tmpdir, 'flow3.svg'))
.add(name='pod_b', needs='gateway')
.needs(['pod_a', 'pod_b'])
)

assert os.path.exists(os.path.join(tmpdir, 'flow3.svg'))


@pytest.mark.skipif("GITHUB_WORKFLOW" in os.environ, reason="Skip unneeded")
def test_flow_before_after_plot(tmpdir):

Flow().add(uses_before=Executor, uses_after=Executor, name='p1').plot(
os.path.join(tmpdir, 'flow.svg')
)
assert os.path.exists(os.path.join(tmpdir, 'flow.svg'))


@pytest.mark.skipif("GITHUB_WORKFLOW" in os.environ, reason="Skip unneeded")
def test_flow_before_plot(tmpdir):
Flow().add(uses_before=Executor, name='p1').plot(os.path.join(tmpdir, 'flow.svg'))
assert os.path.exists(os.path.join(tmpdir, 'flow.svg'))


@pytest.mark.skipif("GITHUB_WORKFLOW" in os.environ, reason="Skip unneeded")
def test_flow_after_plot(tmpdir):
Flow().add(uses_after=Executor, name='p1').plot(os.path.join(tmpdir, 'flow.svg'))
assert os.path.exists(os.path.join(tmpdir, 'flow.svg'))


@pytest.mark.skipif("GITHUB_WORKFLOW" in os.environ, reason="Skip unneeded")
@pytest.mark.parametrize('vertical_layout', [True, False])
def test_flow_vertical(tmpdir, vertical_layout):
def get_image_size(fname):
Expand Down Expand Up @@ -114,11 +122,3 @@ def get_image_size(fname):
assert w_h is not None
w, h = w_h
assert (w < h) == vertical_layout


def test_flow_plot_after_build():
f = Flow().add().add()
with f:
f.plot()

f.plot()

0 comments on commit 413fa7b

Please sign in to comment.