-
Notifications
You must be signed in to change notification settings - Fork 3
/
conftest.py
48 lines (34 loc) · 1.13 KB
/
conftest.py
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
"""
Author(s): Dominik Tran <[email protected]>
Copyright: (C) 2022 CESNET, z.s.p.o.
SPDX-License-Identifier: BSD-3-Clause
Pytest conftest file.
"""
import logging
import os
import pytest
@pytest.fixture(scope="session")
def require_root():
"""Fixture checking whether a test is running under the root."""
if os.geteuid() != 0:
pytest.skip("requires root permissions")
def pytest_addhooks(pluginmanager: pytest.PytestPluginManager):
"""Include fixtures from components.
Register only when plugins were not registered at top-level conftest,
e.g.: when pytest was started from tools/ft-orchestration.
"""
plugins = [
"src.common.fixtures",
"src.common.html_report_plugin",
"src.topology.common",
"src.topology.pcap_player",
"src.topology.replicator",
]
for plugin in plugins:
if not pluginmanager.hasplugin(plugin):
pluginmanager.import_plugin(plugin)
def pytest_configure():
"""Restrict certain loggers so they don't pollute
output with useless messages.
"""
logging.getLogger("paramiko.transport").setLevel(logging.WARNING)