xref: /aosp_15_r20/external/armnn/delegate/python/test/conftest.py (revision 89c4ff92f2867872bb9e2354d150bf0c8c502810)
1# Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
2# SPDX-License-Identifier: MIT
3import pytest
4import os
5
6
7@pytest.fixture(scope="module")
8def test_data_folder(request):
9    """
10    This fixture returns path to the folder with the shared test resources
11    """
12    return str(os.path.join(request.fspath.dirname, "test_data"))
13
14
15def pytest_addoption(parser):
16    """
17    Adds the program option 'delegate-dir' to pytest
18    """
19    parser.addoption("--delegate-dir",
20                     action="append",
21                     help="Directory of the armnn tflite delegate library",
22                     required=True)
23
24
25def pytest_generate_tests(metafunc):
26    """
27    Makes the program option 'delegate-dir' available to all tests as a function fixture
28    """
29    if "delegate_dir" in metafunc.fixturenames:
30        metafunc.parametrize("delegate_dir", metafunc.config.getoption("delegate_dir"))