Skip to content

Commit 4c5e3cc

Browse files
authored
fix VisibleDeprecation Warning (AtsushiSakai#358)
* try coverage * add python warning setting * add random seed for test coverage
1 parent 72c4a89 commit 4c5e3cc

8 files changed

+23
-6
lines changed

SLAM/EKFSLAM/ekf_slam.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def jacob_motion(x, u):
117117

118118
jF = np.array([[0.0, 0.0, -DT * u[0] * math.sin(x[2, 0])],
119119
[0.0, 0.0, DT * u[0] * math.cos(x[2, 0])],
120-
[0.0, 0.0, 0.0]])
120+
[0.0, 0.0, 0.0]], dtype=np.float64)
121121

122122
G = np.eye(STATE_SIZE) + Fx.T @ jF @ Fx
123123

@@ -236,8 +236,9 @@ def main():
236236
if show_animation: # pragma: no cover
237237
plt.cla()
238238
# for stopping simulation with the esc key.
239-
plt.gcf().canvas.mpl_connect('key_release_event',
240-
lambda event: [exit(0) if event.key == 'escape' else None])
239+
plt.gcf().canvas.mpl_connect(
240+
'key_release_event',
241+
lambda event: [exit(0) if event.key == 'escape' else None])
241242

242243
plt.plot(RFID[:, 0], RFID[:, 1], "*k")
243244
plt.plot(xEst[0], xEst[1], ".r")

runtests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env bash
22
echo "Run test suites! "
3+
export PYTHONWARNINGS=default # show warning
34
#python -m unittest discover tests
45
#python -Wignore -m unittest discover tests #ignore warning
56
coverage run -m unittest discover tests # generate coverage file

tests/test_batch_informed_rrt_star.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
from unittest import TestCase
22
import sys
33
import os
4+
import random
45
sys.path.append(os.path.dirname(__file__) + "/../")
56
try:
67
from PathPlanning.BatchInformedRRTStar import batch_informed_rrtstar as m
7-
except:
8+
except ImportError:
89
raise
910

1011
print(__file__)
1112

13+
random.seed(12345)
14+
1215

1316
class Test(TestCase):
1417

tests/test_closed_loop_rrt_star_car.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import os
22
import sys
3+
import random
34
from unittest import TestCase
45

56
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../")
67
sys.path.append(os.path.dirname(os.path.abspath(__file__)) +
78
"/../PathPlanning/ClosedLoopRRTStar/")
89
try:
910
from PathPlanning.ClosedLoopRRTStar import closed_loop_rrt_star_car as m
10-
except:
11+
except ImportError:
1112
raise
1213

14+
random.seed(12345)
1315

1416
print(__file__)
1517

tests/test_dubins_path_planning.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from unittest import TestCase
22

33
import numpy as np
4+
np.random.seed(12345)
45

56
from PathPlanning.DubinsPath import dubins_path_planning
67

tests/test_lqr_rrt_star.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
from unittest import TestCase
22
import sys
33
import os
4+
import random
45
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../")
56
sys.path.append(os.path.dirname(os.path.abspath(__file__))
67
+ "/../PathPlanning/LQRRRTStar/")
78
try:
89
from PathPlanning.LQRRRTStar import lqr_rrt_star as m
9-
except:
10+
except ImportError:
1011
raise
1112

1213
print(__file__)
1314

15+
random.seed(12345)
16+
1417

1518
class Test(TestCase):
1619

tests/test_n_joint_arm_to_point_control.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import sys
3+
import random
34
from unittest import TestCase
45

56
sys.path.append(os.path.dirname(__file__) + "/../ArmNavigation/n_joint_arm_to_point_control/")
@@ -8,6 +9,8 @@
89

910
print(__file__)
1011

12+
random.seed(12345)
13+
1114

1215
class Test(TestCase):
1316

tests/test_rrt.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import sys
3+
import random
34
from unittest import TestCase
45

56
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../")
@@ -12,6 +13,8 @@
1213

1314
print(__file__)
1415

16+
random.seed(12345)
17+
1518

1619
class Test(TestCase):
1720

0 commit comments

Comments
 (0)