Skip to content

Commit d3e2758

Browse files
committed
Update functional tests
1 parent e39ccfc commit d3e2758

File tree

5 files changed

+30
-5
lines changed

5 files changed

+30
-5
lines changed

.github/workflows/test_precommit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- name: Run test
3636
run: |
3737
source venv/bin/activate
38-
pytest tests/python/funtional
38+
pytest --data=./data tests/python/funtional
3939
CPP-Code-Quality:
4040
name: CPP-Code-Quality
4141
runs-on: ubuntu-latest

tests/python/funtional/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#
2+
# Copyright (C) 2024 Intel Corporation
3+
# SPDX-License-Identifier: Apache-2.0
4+
#

tests/python/funtional/conftest.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#
2+
# Copyright (C) 2024 Intel Corporation
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
6+
import pytest
7+
8+
9+
def pytest_addoption(parser):
10+
parser.addoption("--data", action="store", help="data folder with dataset")
11+
12+
13+
@pytest.fixture(scope="session")
14+
def data(pytestconfig):
15+
return pytestconfig.getoption("data")

tests/python/funtional/test_load.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
# Copyright (C) 2020-2024 Intel Corporation
33
# SPDX-License-Identifier: Apache-2.0
44
#
5+
6+
from pathlib import Path
7+
58
from model_api.models import Model
69

710

8-
def test_model_with_unnamed_output_load():
11+
def test_model_with_unnamed_output_load(data):
912
# the model's output doesn't have a name
1013
_ = Model.create_model(
11-
"data/otx_models/tinynet_imagenet.xml",
14+
Path(data) / "otx_models/tinynet_imagenet.xml",
1215
model_type="Classification",
1316
preload=True,
1417
)

tests/python/funtional/test_save.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# Copyright (C) 2020-2024 Intel Corporation
33
# SPDX-License-Identifier: Apache-2.0
44
#
5+
6+
from pathlib import Path
7+
58
from model_api.models import Model
69
from model_api.adapters import ONNXRuntimeAdapter
710
from model_api.adapters.utils import load_parameters_from_onnx
@@ -60,9 +63,9 @@ def test_segmentor_save(tmp_path):
6063
assert getattr(downloaded, attr) == getattr(deserialized, attr)
6164

6265

63-
def test_onnx_save(tmp_path):
66+
def test_onnx_save(tmp_path, data):
6467
cls_model = Model.create_model(
65-
ONNXRuntimeAdapter("data/otx_models/cls_mobilenetv3_large_cars.onnx"),
68+
ONNXRuntimeAdapter(Path(data) / "otx_models/cls_mobilenetv3_large_cars.onnx"),
6669
model_type="Classification",
6770
preload=True,
6871
configuration={"reverse_input_channels": True, "topk": 6},

0 commit comments

Comments
 (0)