diff options
author | Éanna Ó Catháin <eanna.ocathain@arm.com> | 2020-11-16 14:12:11 +0000 |
---|---|---|
committer | Jim Flynn <jim.flynn@arm.com> | 2020-11-17 12:23:56 +0000 |
commit | 145c88f851d12d2cadc2f080d232c1d5963d6e47 (patch) | |
tree | 6ae197d74782cd2c7ef8965f4b36acabc65ce453 /python/pyarmnn/examples/common/tests/conftest.py | |
parent | aa41d5d2f43790938f3a32586626be5ef55b6ca9 (diff) | |
download | armnn-145c88f851d12d2cadc2f080d232c1d5963d6e47.tar.gz |
MLECO-1253 Adding ASR sample application using the PyArmNN api
Change-Id: I450b23800ca316a5bfd4608c8559cf4f11271c21
Signed-off-by: Éanna Ó Catháin <eanna.ocathain@arm.com>
Diffstat (limited to 'python/pyarmnn/examples/common/tests/conftest.py')
-rw-r--r-- | python/pyarmnn/examples/common/tests/conftest.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/python/pyarmnn/examples/common/tests/conftest.py b/python/pyarmnn/examples/common/tests/conftest.py new file mode 100644 index 0000000000..5e027a0125 --- /dev/null +++ b/python/pyarmnn/examples/common/tests/conftest.py @@ -0,0 +1,40 @@ +# Copyright © 2020 Arm Ltd and Contributors. All rights reserved. +# SPDX-License-Identifier: MIT + +import os +import ntpath + +import urllib.request +import zipfile + +import pytest + +script_dir = os.path.dirname(__file__) +@pytest.fixture(scope="session") +def test_data_folder(request): + """ + This fixture returns path to folder with shared test resources among all tests + """ + + data_dir = os.path.join(script_dir, "testdata") + if not os.path.exists(data_dir): + os.mkdir(data_dir) + + files_to_download = ["https://raw.githubusercontent.com/opencv/opencv/4.0.0/samples/data/messi5.jpg", + "https://raw.githubusercontent.com/opencv/opencv/4.0.0/samples/data/basketball1.png", + "https://raw.githubusercontent.com/opencv/opencv/4.0.0/samples/data/Megamind.avi", + "https://storage.googleapis.com/download.tensorflow.org/models/tflite/coco_ssd_mobilenet_v1_1.0_quant_2018_06_29.zip" + ] + + for file in files_to_download: + path, filename = ntpath.split(file) + file_path = os.path.join(data_dir, filename) + if not os.path.exists(file_path): + print("\nDownloading test file: " + file_path + "\n") + urllib.request.urlretrieve(file, file_path) + + # Any unzipping needed, and moving around of files + with zipfile.ZipFile(os.path.join(data_dir, "coco_ssd_mobilenet_v1_1.0_quant_2018_06_29.zip"), 'r') as zip_ref: + zip_ref.extractall(data_dir) + + return data_dir |