Skip to content

Commit 043a03a

Browse files
committed
tests: refactor common utils with path setup
1 parent 8860764 commit 043a03a

File tree

5 files changed

+15
-5
lines changed

5 files changed

+15
-5
lines changed

test/harmonic/test_follow_road.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""Tests for the Vacuum Cleaner (no localization) ROS launch file."""
44

55
import os
6+
import sys
67
import unittest
78
import pytest
89
import time
@@ -27,7 +28,8 @@
2728
QoSHistoryPolicy,
2829
)
2930

30-
from test.utils import stop_gazebo
31+
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
32+
from utils import stop_gazebo # noqa: E402
3133

3234

3335
@pytest.mark.launch_test

test/test_3d_reconstruction.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""Tests for 3D reconstruction ROS launch file."""
44

55
import os
6+
import sys
67
import unittest
78
import pytest
89
import time
@@ -15,7 +16,8 @@
1516
import rclpy
1617
from sensor_msgs.msg import CameraInfo, Image
1718

18-
from test.utils import stop_gazebo
19+
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
20+
from utils import stop_gazebo # noqa: E402
1921

2022

2123
@pytest.mark.launch_test

test/test_follow_person_followingcam.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""Tests for follow person following camera ROS launch file."""
44

55
import os
6+
import sys
67
import time
78
import unittest
89
import pytest
@@ -16,7 +17,8 @@
1617
from sensor_msgs.msg import Imu, JointState
1718
from nav_msgs.msg import Odometry
1819

19-
from test.utils import stop_gazebo
20+
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
21+
from utils import stop_gazebo # noqa: E402
2022

2123

2224
@pytest.mark.launch_test

test/test_simple_circuit.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""Tests for Line Follower (Simple Circuit) ROS launch file."""
44

55
import os
6+
import sys
67
import unittest
78
import pytest
89
import time
@@ -17,7 +18,8 @@
1718
from nav_msgs.msg import Odometry
1819
from geometry_msgs.msg import Twist
1920

20-
from test.utils import stop_gazebo
21+
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
22+
from utils import stop_gazebo # noqa: E402
2123

2224

2325
@pytest.mark.launch_test

test/test_vacuum_cleaner.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""Tests for the Vacuum Cleaner (no localization) ROS launch file."""
44

55
import os
6+
import sys
67
import unittest
78
import pytest
89
import time
@@ -17,7 +18,8 @@
1718
from geometry_msgs.msg import Twist
1819
from sensor_msgs.msg import LaserScan
1920

20-
from test.utils import stop_gazebo
21+
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
22+
from utils import stop_gazebo # noqa: E402
2123

2224

2325
@pytest.mark.launch_test

0 commit comments

Comments
 (0)