forked from nvidia-holoscan/holoscan-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
100 lines (72 loc) · 2.83 KB
/
Copy pathconftest.py
File metadata and controls
100 lines (72 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
"""
SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
""" # noqa: E501
import os
import pytest
from holoscan.core import Application, Fragment
from holoscan.logger import LogLevel, set_log_level
# set log level to INFO during testing
set_log_level(LogLevel.INFO)
@pytest.fixture
def app():
return Application()
@pytest.fixture
def fragment():
return Fragment()
@pytest.fixture
def operators_config_file():
yaml_file_dir = os.path.dirname(__file__)
config_file = os.path.join(yaml_file_dir, "operator_parameters.yaml")
return config_file
@pytest.fixture
def data_loggers_config_file():
yaml_file_dir = os.path.dirname(__file__)
config_file = os.path.join(yaml_file_dir, "data_logger_parameters.yaml")
return config_file
@pytest.fixture
def ping_config_file():
yaml_file_dir = os.path.dirname(__file__)
config_file = os.path.join(yaml_file_dir, "app_config_ping.yaml")
return config_file
@pytest.fixture
def deprecated_extension_config_file():
yaml_file_dir = os.path.dirname(__file__)
config_file = os.path.join(yaml_file_dir, "deprecated_stream_playback.yaml")
return config_file
def pytest_configure(config): # noqa: ARG001
os.environ["HOLOSCAN_DISABLE_BACKTRACE"] = "1"
def pytest_addoption(parser):
parser.addoption(
"--runslow",
"--run-slow",
action="store_true",
help="include tests marked slow (--runslow and --run-slow are equivalent)",
)
parser.addoption(
"--run-realtime",
action="store_true",
default=False,
help="run tests marked as requiring real-time kernel config",
)
def pytest_collection_modifyitems(config, items):
if not config.getoption("--runslow"):
skip_slow = pytest.mark.skip(reason="need --run-slow (or --runslow) option to run")
for item in items:
if item.get_closest_marker("slow"):
item.add_marker(skip_slow)
if not config.getoption("--run-realtime"):
skip_realtime = pytest.mark.skip(reason="need --run-realtime option to run")
for item in items:
if item.get_closest_marker("realtime"):
item.add_marker(skip_realtime)
# Note: see [tool.pytest.ini_options] in pyproject.toml for marker definitions