aboutsummaryrefslogtreecommitdiff
path: root/python/pyarmnn/examples/speech_recognition/tests/conftest.py
diff options
context:
space:
mode:
authorÉanna Ó Catháin <eanna.ocathain@arm.com>2020-11-16 14:12:11 +0000
committerJim Flynn <jim.flynn@arm.com>2020-11-17 12:23:56 +0000
commit145c88f851d12d2cadc2f080d232c1d5963d6e47 (patch)
tree6ae197d74782cd2c7ef8965f4b36acabc65ce453 /python/pyarmnn/examples/speech_recognition/tests/conftest.py
parentaa41d5d2f43790938f3a32586626be5ef55b6ca9 (diff)
downloadarmnn-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/speech_recognition/tests/conftest.py')
-rw-r--r--python/pyarmnn/examples/speech_recognition/tests/conftest.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/python/pyarmnn/examples/speech_recognition/tests/conftest.py b/python/pyarmnn/examples/speech_recognition/tests/conftest.py
new file mode 100644
index 0000000000..730c291cfa
--- /dev/null
+++ b/python/pyarmnn/examples/speech_recognition/tests/conftest.py
@@ -0,0 +1,34 @@
+# Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
+# SPDX-License-Identifier: MIT
+
+import os
+import ntpath
+
+import urllib.request
+
+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/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(script_dir, "testdata", filename)
+ if not os.path.exists(file_path):
+ print("\nDownloading test file: " + file_path + "\n")
+ urllib.request.urlretrieve(file, file_path)
+
+ return data_dir