Skip to content

Commit e7715fa

Browse files
authored
[SW-562] update unit test skipif condition for mac-related issues (#102)
Update several unit tests' skipif condition according to actions/setup-python#649
1 parent 01c2660 commit e7715fa

File tree

7 files changed

+303
-326
lines changed

7 files changed

+303
-326
lines changed

tests/base/test_graphics.py

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,22 @@ def teardown_method(self, method):
1414
plt.close("all")
1515

1616
@pytest.mark.skipif(
17-
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
17+
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
18+
reason="tkinter bug with mac",
1819
)
1920
def test_plotvol2(self):
2021
plotvol2(5)
2122

2223
@pytest.mark.skipif(
23-
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
24+
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
25+
reason="tkinter bug with mac",
2426
)
2527
def test_plotvol3(self):
2628
plotvol3(5)
2729

2830
@pytest.mark.skipif(
29-
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
31+
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
32+
reason="tkinter bug with mac",
3033
)
3134
def test_plot_point(self):
3235
plot_point((2, 3))
@@ -35,14 +38,16 @@ def test_plot_point(self):
3538
plot_point((2, 3), "x", text="foo")
3639

3740
@pytest.mark.skipif(
38-
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
41+
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
42+
reason="tkinter bug with mac",
3943
)
4044
def test_plot_text(self):
4145
plot_text((2, 3), "foo")
4246
plot_text(np.r_[2, 3], "foo")
4347

4448
@pytest.mark.skipif(
45-
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
49+
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
50+
reason="tkinter bug with mac",
4651
)
4752
def test_plot_box(self):
4853
plot_box("r--", centre=(-2, -3), wh=(1, 1))
@@ -54,15 +59,17 @@ def test_plot_box(self):
5459
plot_box(centre=(1, 2), wh=(2, 3))
5560

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

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

7481
@pytest.mark.skipif(
75-
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
82+
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
83+
reason="tkinter bug with mac",
7684
)
7785
def test_plot_homline(self):
7886
plot_homline((1, 2, 3))
7987
plot_homline((2, 1, 3))
8088
plot_homline((1, -2, 3), "k--")
8189

8290
@pytest.mark.skipif(
83-
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
91+
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
92+
reason="tkinter bug with mac",
8493
)
8594
def test_cuboid(self):
8695
plot_cuboid((1, 2, 3), color="g")
8796
plot_cuboid((1, 2, 3), centre=(2, 3, 4), color="g")
8897
plot_cuboid((1, 2, 3), filled=True, color="y")
8998

9099
@pytest.mark.skipif(
91-
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
100+
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
101+
reason="tkinter bug with mac",
92102
)
93103
def test_sphere(self):
94104
plot_sphere(0.3, color="r")
95105
plot_sphere(1, centre=(1, 1, 1), filled=True, color="b")
96106

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

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

120132
@pytest.mark.skipif(
121-
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
133+
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
134+
reason="tkinter bug with mac",
122135
)
123136
def test_cone(self):
124137
plot_cone(radius=0.2, centre=(0.5, 0.5, 0), height=0.3)

tests/base/test_transforms2d.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ def test_trinterp2(self):
262262
)
263263

264264
@pytest.mark.skipif(
265-
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
265+
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
266+
reason="tkinter bug with mac",
266267
)
267268
def test_plot(self):
268269
plt.figure()

tests/base/test_transforms3d_plot.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525

2626
class Test3D(unittest.TestCase):
2727
@pytest.mark.skipif(
28-
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
28+
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
29+
reason="tkinter bug with mac",
2930
)
3031
def test_plot(self):
3132
plt.figure()
@@ -71,7 +72,8 @@ def test_plot(self):
7172
plt.close("all")
7273

7374
@pytest.mark.skipif(
74-
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
75+
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
76+
reason="tkinter bug with mac",
7577
)
7678
def test_animate(self):
7779
tranimate(transl(1, 2, 3), repeat=False, wait=True)

tests/test_geom2d.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ def test_intersect_line(self):
8888
self.assertFalse(p.intersects(l))
8989

9090
@pytest.mark.skipif(
91-
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
91+
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
92+
reason="tkinter bug with mac",
9293
)
9394
def test_plot(self):
9495
p = Polygon2(np.array([[-1, 1, 1, -1], [-1, -1, 1, 1]]))

tests/test_geom3d.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ def test_closest(self):
126126
self.assertAlmostEqual(d, 2)
127127

128128
@pytest.mark.skipif(
129-
sys.platform.startswith("darwin"), reason="tkinter bug with mac"
129+
sys.platform.startswith("darwin") and sys.version_info < (3, 11),
130+
reason="tkinter bug with mac",
130131
)
131132
def test_plot(self):
132133
P = [2, 3, 7]

0 commit comments

Comments
 (0)