conftest.py
Go to the documentation of this file.
1 import os
2 
3 import pytest
4 from _pytest.config.argparsing import Parser
5 from _pytest.fixtures import SubRequest
6 
7 
8 def pytest_addoption(parser):
9  # type: (Parser) -> None
10  parser.addoption(
11  "--ros-root",
12  help="Root directory of a ROS distribution",
13  default="/opt/ros/noetic",
14  )
15  parser.addoption(
16  "--python-version",
17  help="Python version for finding ROS libraries",
18  default="3",
19  )
20 
21 
22 @pytest.fixture
23 def ros_root_directory(request):
24  # type: (SubRequest) -> str
25  return str(request.config.getoption("--ros-root"))
26 
27 
28 @pytest.fixture
29 def ros_share_directory(ros_root_directory):
30  # type: (str) -> str
31  return os.path.join(ros_root_directory, "share")
32 
33 
34 @pytest.fixture
35 def ros_python_library_directory(request, ros_root_directory):
36  # type: (SubRequest, str) -> str
37  py_version = request.config.getoption("--python-version")
38  return os.path.join(
39  ros_root_directory, "lib/python{}/dist-packages".format(py_version)
40  )
41 
42 
43 @pytest.fixture
44 def std_msgs_path(ros_share_directory):
45  # type: (str) -> str
46  return os.path.join(ros_share_directory, "std_msgs")
47 
48 
49 @pytest.fixture
50 def std_msgs_py_path(ros_python_library_directory):
51  # type: (str) -> str
52  return os.path.join(ros_python_library_directory, "std_msgs")
53 
54 
55 @pytest.fixture
56 def sensor_msgs_path(ros_share_directory):
57  # type: (str) -> str
58  return os.path.join(ros_share_directory, "sensor_msgs")
59 
60 
61 @pytest.fixture
62 def sensor_msgs_py_path(ros_python_library_directory):
63  # type: (str) -> str
64  return os.path.join(ros_python_library_directory, "sensor_msgs")
65 
66 
67 @pytest.fixture
68 def geometry_msgs_path(ros_share_directory):
69  # type: (str) -> str
70  return os.path.join(ros_share_directory, "geometry_msgs")
71 
72 
73 @pytest.fixture
74 def nav_msgs_path(ros_share_directory):
75  # type: (str) -> str
76  return os.path.join(ros_share_directory, "nav_msgs")
conftest.ros_python_library_directory
def ros_python_library_directory(request, ros_root_directory)
Definition: conftest.py:35
conftest.ros_root_directory
def ros_root_directory(request)
Definition: conftest.py:23
conftest.std_msgs_py_path
def std_msgs_py_path(ros_python_library_directory)
Definition: conftest.py:50
conftest.ros_share_directory
def ros_share_directory(ros_root_directory)
Definition: conftest.py:29
conftest.nav_msgs_path
def nav_msgs_path(ros_share_directory)
Definition: conftest.py:74
conftest.std_msgs_path
def std_msgs_path(ros_share_directory)
Definition: conftest.py:44
conftest.sensor_msgs_py_path
def sensor_msgs_py_path(ros_python_library_directory)
Definition: conftest.py:62
conftest.sensor_msgs_path
def sensor_msgs_path(ros_share_directory)
Definition: conftest.py:56
conftest.pytest_addoption
def pytest_addoption(parser)
Definition: conftest.py:8
conftest.geometry_msgs_path
def geometry_msgs_path(ros_share_directory)
Definition: conftest.py:68


genmypy
Author(s): Yuki Igarashi, Tamaki Nishino
autogenerated on Mon Apr 10 2023 03:01:12