aboutsummaryrefslogtreecommitdiff
path: root/python/pyarmnn/conftest.py
diff options
context:
space:
mode:
authorRichard Burton <richard.burton@arm.com>2020-04-08 16:39:05 +0100
committerJim Flynn <jim.flynn@arm.com>2020-04-10 16:11:09 +0000
commitdc0c6ed9f8b993e63f492f203d7d7080ab4c835c (patch)
treeea8541990b13ebf1a038009aa6b8b4b1ea8c3f55 /python/pyarmnn/conftest.py
parentfe5a24beeef6e9a41366e694f41093565e748048 (diff)
downloadarmnn-dc0c6ed9f8b993e63f492f203d7d7080ab4c835c.tar.gz
Add PyArmNN to work with ArmNN API of 20.02
* Add Swig rules for generating python wrapper * Add documentation * Add tests and testing data Change-Id: If48eda08931514fa21e72214dfead2835f07237c Signed-off-by: Richard Burton <richard.burton@arm.com> Signed-off-by: Derek Lamberti <derek.lamberti@arm.com>
Diffstat (limited to 'python/pyarmnn/conftest.py')
-rw-r--r--python/pyarmnn/conftest.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/python/pyarmnn/conftest.py b/python/pyarmnn/conftest.py
new file mode 100644
index 0000000000..af6b8da742
--- /dev/null
+++ b/python/pyarmnn/conftest.py
@@ -0,0 +1,52 @@
+# Copyright © 2020 Arm Ltd. All rights reserved.
+# SPDX-License-Identifier: MIT
+import os
+import platform
+
+import pytest
+
+ARCHITECTURES = set("x86_64 aarch64".split())
+
+
+@pytest.fixture(scope="module")
+def data_folder_per_test(request):
+ """
+ This fixture returns path to folder with test resources (one per test module)
+ """
+
+ basedir, script = request.fspath.dirname, request.fspath.basename
+ return str(os.path.join(basedir, "testdata", os.path.splitext(script)[0]))
+
+
+@pytest.fixture(scope="module")
+def shared_data_folder(request):
+ """
+ This fixture returns path to folder with shared test resources among all tests
+ """
+
+ return str(os.path.join(request.fspath.dirname, "testdata", "shared"))
+
+
+@pytest.fixture(scope="function")
+def tmpdir(tmpdir):
+ """
+ This fixture returns path to temp folder. Fixture was added for py35 compatibility
+ """
+
+ return str(tmpdir)
+
+
+def pytest_runtest_setup(item):
+ supported_architectures = ARCHITECTURES.intersection(mark.name for mark in item.iter_markers())
+ arch = platform.machine()
+ if supported_architectures and arch not in supported_architectures:
+ pytest.skip("cannot run on platform {}".format(arch))
+
+
+def pytest_configure(config):
+ config.addinivalue_line(
+ "markers", "aarch64: mark test to run only on aarch64"
+ )
+ config.addinivalue_line(
+ "markers", "x86_64: mark test to run only on x86_64"
+ ) \ No newline at end of file