blob: 0eea35c7e002a91ff3781cef89be482e1e7299ad [file] [log] [blame]
Matthew Bentham245d64c2019-12-02 12:59:43 +00001# Copyright © 2019 Arm Ltd. All rights reserved.
2# SPDX-License-Identifier: MIT
3import os
4
5import pytest
6
7
8@pytest.fixture(scope="module")
9def data_folder_per_test(request):
10 """
11 This fixture returns path to folder with test resources (one per test module)
12 """
13
14 basedir, script = request.fspath.dirname, request.fspath.basename
15 return str(os.path.join(basedir, "testdata", os.path.splitext(script)[0]))
16
17
18@pytest.fixture(scope="module")
19def shared_data_folder(request):
20 """
21 This fixture returns path to folder with shared test resources among all tests
22 """
23
24 return str(os.path.join(request.fspath.dirname, "testdata", "shared"))
25
26
27@pytest.fixture(scope="function")
28def tmpdir(tmpdir):
29 """
30 This fixture returns path to temp folder. Fixture was added for py35 compatibility
31 """
32
33 return str(tmpdir)
34
35
36def pytest_addoption(parser):
37 parser.addoption('--juno', action='store_true', dest="juno",
38 default=False, help="enable juno fpga related tests")
39
40
41def pytest_configure(config):
42 config.addinivalue_line(
43 "markers", "juno: mark test to run only on juno"
44 )
45
46 if not config.option.juno:
47 setattr(config.option, 'markexpr', 'not juno')