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 c5def8f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,9 @@ jobs:
WHEEL_FILE=$(ls dist/*whl)
pip install "$WHEEL_FILE[common,devel,test]" --no-cache-dir
if [[ "${{ matrix.protobuf-version }}" == "==3.19.6" ]]; then
pip install -U protobuf${{ matrix.protobuf-version }} grpcio==1.47.5 grpcio-reflection==1.47.5 grpcio-health-checking==1.47.5
pip install -U protobuf${{ matrix.protobuf-version }} grpcio==1.65.5 grpcio-reflection==1.65.5 grpcio-health-checking==1.65.5
else
pip install -U protobuf${{ matrix.protobuf-version }}
pip install -U protobuf${{ matrix.protobuf-version }} grpcio==1.65.5 grpcio-reflection==1.65.5 grpcio-health-checking==1.65.5
fi
jina
export JINA_LOG_LEVEL="ERROR"
Expand Down Expand Up @@ -546,9 +546,9 @@ jobs:
WHEEL_FILE=$(ls dist/*whl)
pip install "$WHEEL_FILE[common,devel,test]" --no-cache-dir
if [[ "${{ matrix.protobuf-version }}" == "==3.19.6" ]]; then
pip install -U protobuf${{ matrix.protobuf-version }} grpcio==1.47.5 grpcio-reflection==1.47.5 grpcio-health-checking==1.47.5
pip install -U protobuf${{ matrix.protobuf-version }} grpcio==1.65.5 grpcio-reflection==1.65.5 grpcio-health-checking==1.65.5
else
pip install -U protobuf${{ matrix.protobuf-version }}
pip install -U protobuf${{ matrix.protobuf-version }} grpcio==1.65.5 grpcio-reflection==1.65.5 grpcio-health-checking==1.65.5
fi
jina
export JINA_LOG_LEVEL="ERROR"
Expand Down Expand Up @@ -731,6 +731,7 @@ jobs:
WHEEL_FILE=$(ls dist/*whl)
pip install "$WHEEL_FILE[all]" --no-cache-dir
pip install docarray==0.21.0
pip install grpcio==1.65.5 grpcio-reflection==1.65.5 grpcio-health-checking==1.65.5
jina
export JINA_LOG_LEVEL="ERROR"
- name: Test
Expand Down
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")
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 c5def8f

Please sign in to comment.