Skip to content

Commit

Permalink
[SW-562] update unit test skipif condition for mac-related issues (#102)
Browse files Browse the repository at this point in the history
Update several unit tests' skipif condition according to actions/setup-python#649
  • Loading branch information
jcao-bdai authored Nov 20, 2023
1 parent 01c2660 commit e7715fa
Show file tree
Hide file tree
Showing 7 changed files with 303 additions and 326 deletions.
39 changes: 26 additions & 13 deletions tests/base/test_graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,22 @@ def teardown_method(self, method):
plt.close("all")

@pytest.mark.skipif(
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
reason="tkinter bug with mac",
)
def test_plotvol2(self):
plotvol2(5)

@pytest.mark.skipif(
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
reason="tkinter bug with mac",
)
def test_plotvol3(self):
plotvol3(5)

@pytest.mark.skipif(
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
reason="tkinter bug with mac",
)
def test_plot_point(self):
plot_point((2, 3))
Expand All @@ -35,14 +38,16 @@ def test_plot_point(self):
plot_point((2, 3), "x", text="foo")

@pytest.mark.skipif(
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
reason="tkinter bug with mac",
)
def test_plot_text(self):
plot_text((2, 3), "foo")
plot_text(np.r_[2, 3], "foo")

@pytest.mark.skipif(
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
reason="tkinter bug with mac",
)
def test_plot_box(self):
plot_box("r--", centre=(-2, -3), wh=(1, 1))
Expand All @@ -54,15 +59,17 @@ def test_plot_box(self):
plot_box(centre=(1, 2), wh=(2, 3))

@pytest.mark.skipif(
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
reason="tkinter bug with mac",
)
def test_plot_circle(self):
plot_circle(1, (0, 0), "r") # red circle
plot_circle(2, (0, 0), "b--") # blue dashed circle
plot_circle(0.5, (0, 0), filled=True, color="y") # yellow filled circle

@pytest.mark.skipif(
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
reason="tkinter bug with mac",
)
def test_ellipse(self):
plot_ellipse(np.diag((1, 2)), (0, 0), "r") # red ellipse
Expand All @@ -72,30 +79,34 @@ def test_ellipse(self):
) # yellow filled ellipse

@pytest.mark.skipif(
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
reason="tkinter bug with mac",
)
def test_plot_homline(self):
plot_homline((1, 2, 3))
plot_homline((2, 1, 3))
plot_homline((1, -2, 3), "k--")

@pytest.mark.skipif(
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
reason="tkinter bug with mac",
)
def test_cuboid(self):
plot_cuboid((1, 2, 3), color="g")
plot_cuboid((1, 2, 3), centre=(2, 3, 4), color="g")
plot_cuboid((1, 2, 3), filled=True, color="y")

@pytest.mark.skipif(
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
reason="tkinter bug with mac",
)
def test_sphere(self):
plot_sphere(0.3, color="r")
plot_sphere(1, centre=(1, 1, 1), filled=True, color="b")

@pytest.mark.skipif(
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
reason="tkinter bug with mac",
)
def test_ellipsoid(self):
plot_ellipsoid(np.diag((1, 2, 3)), color="r") # red ellipsoid
Expand All @@ -104,7 +115,8 @@ def test_ellipsoid(self):
) # yellow filled ellipsoid

@pytest.mark.skipif(
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
reason="tkinter bug with mac",
)
def test_cylinder(self):
plot_cylinder(radius=0.2, centre=(0.5, 0.5, 0), height=[-0.2, 0.2])
Expand All @@ -118,7 +130,8 @@ def test_cylinder(self):
)

@pytest.mark.skipif(
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
reason="tkinter bug with mac",
)
def test_cone(self):
plot_cone(radius=0.2, centre=(0.5, 0.5, 0), height=0.3)
Expand Down
3 changes: 2 additions & 1 deletion tests/base/test_transforms2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ def test_trinterp2(self):
)

@pytest.mark.skipif(
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
reason="tkinter bug with mac",
)
def test_plot(self):
plt.figure()
Expand Down
6 changes: 4 additions & 2 deletions tests/base/test_transforms3d_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@

class Test3D(unittest.TestCase):
@pytest.mark.skipif(
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
reason="tkinter bug with mac",
)
def test_plot(self):
plt.figure()
Expand Down Expand Up @@ -71,7 +72,8 @@ def test_plot(self):
plt.close("all")

@pytest.mark.skipif(
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
reason="tkinter bug with mac",
)
def test_animate(self):
tranimate(transl(1, 2, 3), repeat=False, wait=True)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_geom2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ def test_intersect_line(self):
self.assertFalse(p.intersects(l))

@pytest.mark.skipif(
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
reason="tkinter bug with mac",
)
def test_plot(self):
p = Polygon2(np.array([[-1, 1, 1, -1], [-1, -1, 1, 1]]))
Expand Down
3 changes: 2 additions & 1 deletion tests/test_geom3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ def test_closest(self):
self.assertAlmostEqual(d, 2)

@pytest.mark.skipif(
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
reason="tkinter bug with mac",
)
def test_plot(self):
P = [2, 3, 7]
Expand Down
Loading

0 comments on commit e7715fa

Please sign in to comment.