11import unittest
22import numpy as np
33import matplotlib .pyplot as plt
4+ import pytest
5+ import sys
46from spatialmath .base import *
57
68# test graphics primitives
@@ -11,22 +13,37 @@ class TestGraphics(unittest.TestCase):
1113 def teardown_method (self , method ):
1214 plt .close ("all" )
1315
16+ @pytest .mark .skipif (
17+ sys .platform .startswith ("darwin" ), reason = "tkinter bug with mac"
18+ )
1419 def test_plotvol2 (self ):
1520 plotvol2 (5 )
1621
22+ @pytest .mark .skipif (
23+ sys .platform .startswith ("darwin" ), reason = "tkinter bug with mac"
24+ )
1725 def test_plotvol3 (self ):
1826 plotvol3 (5 )
1927
28+ @pytest .mark .skipif (
29+ sys .platform .startswith ("darwin" ), reason = "tkinter bug with mac"
30+ )
2031 def test_plot_point (self ):
2132 plot_point ((2 , 3 ))
2233 plot_point (np .r_ [2 , 3 ])
2334 plot_point ((2 , 3 ), "x" )
2435 plot_point ((2 , 3 ), "x" , text = "foo" )
2536
37+ @pytest .mark .skipif (
38+ sys .platform .startswith ("darwin" ), reason = "tkinter bug with mac"
39+ )
2640 def test_plot_text (self ):
2741 plot_text ((2 , 3 ), "foo" )
2842 plot_text (np .r_ [2 , 3 ], "foo" )
2943
44+ @pytest .mark .skipif (
45+ sys .platform .startswith ("darwin" ), reason = "tkinter bug with mac"
46+ )
3047 def test_plot_box (self ):
3148 plot_box ("r--" , centre = (- 2 , - 3 ), wh = (1 , 1 ))
3249 plot_box (lt = (1 , 1 ), rb = (2 , 0 ), filled = True , color = "b" )
@@ -36,38 +53,59 @@ def test_plot_box(self):
3653 plot_box (lbwh = (1 , 2 , 3 , 4 ))
3754 plot_box (centre = (1 , 2 ), wh = (2 , 3 ))
3855
56+ @pytest .mark .skipif (
57+ sys .platform .startswith ("darwin" ), reason = "tkinter bug with mac"
58+ )
3959 def test_plot_circle (self ):
4060 plot_circle (1 , (0 , 0 ), "r" ) # red circle
4161 plot_circle (2 , (0 , 0 ), "b--" ) # blue dashed circle
4262 plot_circle (0.5 , (0 , 0 ), filled = True , color = "y" ) # yellow filled circle
4363
64+ @pytest .mark .skipif (
65+ sys .platform .startswith ("darwin" ), reason = "tkinter bug with mac"
66+ )
4467 def test_ellipse (self ):
4568 plot_ellipse (np .diag ((1 , 2 )), (0 , 0 ), "r" ) # red ellipse
4669 plot_ellipse (np .diag ((1 , 2 )), (0 , 0 ), "b--" ) # blue dashed ellipse
4770 plot_ellipse (
4871 np .diag ((1 , 2 )), centre = (1 , 1 ), filled = True , color = "y"
4972 ) # yellow filled ellipse
5073
74+ @pytest .mark .skipif (
75+ sys .platform .startswith ("darwin" ), reason = "tkinter bug with mac"
76+ )
5177 def test_plot_homline (self ):
5278 plot_homline ((1 , 2 , 3 ))
5379 plot_homline ((2 , 1 , 3 ))
5480 plot_homline ((1 , - 2 , 3 ), "k--" )
5581
82+ @pytest .mark .skipif (
83+ sys .platform .startswith ("darwin" ), reason = "tkinter bug with mac"
84+ )
5685 def test_cuboid (self ):
5786 plot_cuboid ((1 , 2 , 3 ), color = "g" )
5887 plot_cuboid ((1 , 2 , 3 ), centre = (2 , 3 , 4 ), color = "g" )
5988 plot_cuboid ((1 , 2 , 3 ), filled = True , color = "y" )
6089
90+ @pytest .mark .skipif (
91+ sys .platform .startswith ("darwin" ), reason = "tkinter bug with mac"
92+ )
6193 def test_sphere (self ):
6294 plot_sphere (0.3 , color = "r" )
6395 plot_sphere (1 , centre = (1 , 1 , 1 ), filled = True , color = "b" )
6496
97+ @pytest .mark .skipif (
98+ sys .platform .startswith ("darwin" ), reason = "tkinter bug with mac"
99+ )
65100 def test_ellipsoid (self ):
66101 plot_ellipsoid (np .diag ((1 , 2 , 3 )), color = "r" ) # red ellipsoid
67102 plot_ellipsoid (
68103 np .diag ((1 , 2 , 3 )), centre = (1 , 2 , 3 ), filled = True , color = "y"
69104 ) # yellow filled ellipsoid
70105
106+ @pytest .mark .skipif (
107+ sys .platform .startswith ("darwin" ), reason = "tkinter bug with mac"
108+ )
71109 def test_cylinder (self ):
72110 plot_cylinder (radius = 0.2 , centre = (0.5 , 0.5 , 0 ), height = [- 0.2 , 0.2 ])
73111 plot_cylinder (
@@ -79,6 +117,9 @@ def test_cylinder(self):
79117 color = "red" ,
80118 )
81119
120+ @pytest .mark .skipif (
121+ sys .platform .startswith ("darwin" ), reason = "tkinter bug with mac"
122+ )
82123 def test_cone (self ):
83124 plot_cone (radius = 0.2 , centre = (0.5 , 0.5 , 0 ), height = 0.3 )
84125 plot_cone (
0 commit comments