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 94bf000
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 27 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ jobs:
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
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 @@ -213,7 +213,7 @@ jobs:
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
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 @@ -479,6 +479,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
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ jobs:
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
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 @@ -548,7 +548,7 @@ jobs:
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
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()
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@ def test_add_needs_inspect(tmpdir):
.needs(['executor0', 'executor1'])
)
with f1:
_ = f1.index(from_ndarray(np.random.random([5, 5])))
f2 = Flow.load_config('yaml/flow-v1.0-syntax.yml')
pass

f2 = Flow.load_config('yaml/flow-v1.0-syntax.yml')

with f2:
_ = f2.index(from_ndarray(np.random.random([5, 5])))
with f2:
pass

assert f1 == f2
assert f1._deployment_nodes == f2._deployment_nodes


def test_load_dump_load(tmpdir):
Expand Down

0 comments on commit 94bf000

Please sign in to comment.