aboutsummaryrefslogtreecommitdiff
path: root/python/pyarmnn/examples/tests/conftest.py
diff options
context:
space:
mode:
authoralexander <alexander.efremov@arm.com>2021-07-16 11:30:56 +0100
committerJim Flynn <jim.flynn@arm.com>2022-02-04 09:55:21 +0000
commitf42f56870c6201a876f025a423eb5540d7438e83 (patch)
treee8e57e371c851cbb9a51a2f3ec35059addd2e93e /python/pyarmnn/examples/tests/conftest.py
parent9d74ba6e85a043e9603445e062315f5c4965fbd6 (diff)
downloadarmnn-f42f56870c6201a876f025a423eb5540d7438e83.tar.gz
MLECO-2079 Adding the python KWS example
Signed-off-by: Eanna O Cathain <eanna.ocathain@arm.com> Change-Id: Ie1463aaeb5e3cade22df8f560ae99a8e1c4a9c17
Diffstat (limited to 'python/pyarmnn/examples/tests/conftest.py')
-rw-r--r--python/pyarmnn/examples/tests/conftest.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/python/pyarmnn/examples/tests/conftest.py b/python/pyarmnn/examples/tests/conftest.py
new file mode 100644
index 0000000000..b7fa73b852
--- /dev/null
+++ b/python/pyarmnn/examples/tests/conftest.py
@@ -0,0 +1,39 @@
+# Copyright © 2021 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():
+ """
+ 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://github.com/ARM-software/ML-zoo/raw/master/models/object_detection/ssd_mobilenet_v1/tflite_uint8/ssd_mobilenet_v1.tflite",
+ "https://git.mlplatform.org/ml/ethos-u/ml-embedded-evaluation-kit.git/plain/resources/kws/samples/yes.wav",
+ "https://raw.githubusercontent.com/Azure-Samples/cognitive-services-speech-sdk/master/sampledata/audiofiles/myVoiceIsMyPassportVerifyMe04.wav"
+ ]
+
+ 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)
+
+
+ return data_dir