Publishing 2019 R1 content
[platform/upstream/dldt.git] / tools / accuracy_checker / tests / conftest.py
1 """
2 Copyright (c) 2019 Intel Corporation
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8       http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 """
16
17 import os
18 from pathlib import Path
19
20 import pytest
21
22 test_root = Path(__file__).parent
23 project_root = test_root.parent
24
25
26 def pytest_addoption(parser):
27     parser.addoption(
28         "--caffe_logging", action="store_true", default=False, help="Enable Google log"
29     )
30
31
32 def pytest_configure(config):
33     if not config.getoption('caffe_logging'):
34         os.environ['GLOG_minloglevel'] = '2'
35
36
37 @pytest.fixture
38 def data_dir():
39     return project_root / 'data' / 'test_data'
40
41
42 @pytest.fixture
43 def models_dir():
44     return project_root / 'data' / 'test_models'
45
46
47 @pytest.fixture
48 def mock_path_exists(mocker):
49     mocker.patch('pathlib.Path.exists', return_value=True)
50     mocker.patch('pathlib.Path.is_dir', return_value=True)
51     mocker.patch('pathlib.Path.is_file', return_value=True)
52     mocker.patch('os.path.exists', return_value=True)