Kshitij Sisodia | f9efe0d | 2022-09-30 16:42:50 +0100 | [diff] [blame] | 1 | # |
| 2 | # SPDX-FileCopyrightText: Copyright 2021-2022 Arm Limited and/or its affiliates <open-source-office@arm.com> |
| 3 | # SPDX-License-Identifier: Apache-2.0 |
| 4 | # |
| 5 | import os |
| 6 | import pytest |
| 7 | |
| 8 | |
| 9 | @pytest.fixture(scope="module") |
| 10 | def data_folder_per_test(request): |
| 11 | """ |
| 12 | This fixture returns path to folder with test resources (one per test module) |
| 13 | """ |
| 14 | |
| 15 | basedir, script = request.fspath.dirname, request.fspath.basename |
| 16 | return str(os.path.join(basedir, "testdata", os.path.splitext(script)[0])) |
| 17 | |
| 18 | |
| 19 | @pytest.fixture(scope="module") |
| 20 | def shared_data_folder(request): |
| 21 | """ |
| 22 | This fixture returns path to folder with shared test resources among all tests |
| 23 | """ |
| 24 | |
| 25 | return str(os.path.join(request.fspath.dirname, "testdata", "shared")) |
| 26 | |
| 27 | |
| 28 | @pytest.fixture(scope="function") |
| 29 | def tmpdir(tmpdir): |
| 30 | """ |
| 31 | This fixture returns path to temp folder. Fixture was added for py35 compatibility |
| 32 | """ |
| 33 | |
| 34 | return str(tmpdir) |