Jan Eilers | 2cd1847 | 2020-12-15 10:42:38 +0000 | [diff] [blame] | 1 | # Copyright © 2020 Arm Ltd and Contributors. All rights reserved. |
| 2 | # SPDX-License-Identifier: MIT |
| 3 | import pytest |
| 4 | import os |
| 5 | |
| 6 | |
| 7 | @pytest.fixture(scope="module") |
| 8 | def 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 | |
| 15 | def 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 | |
| 25 | def 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")) |