Skip to content

Commit 4ca98ce

Browse files
jacobrkerstetterpyansys-ci-botpre-commit-ci[bot]
authored
test: reenable tessellation tests (#2369)
Co-authored-by: pyansys-ci-bot <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent d8d5c4c commit 4ca98ce

File tree

2 files changed

+84
-39
lines changed

2 files changed

+84
-39
lines changed

doc/changelog.d/2369.test.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Re-enable tessellation tests

tests/integration/test_tessellation.py

Lines changed: 83 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
@pytest.mark.skipif(
3636
not are_graphics_available(), reason="Skipping due to graphics requirements missing"
3737
)
38-
@pytest.mark.skip(reason="Skipping to promote new CS package")
3938
def test_body_tessellate(modeler: Modeler):
4039
"""Test the body tessellation."""
4140
sketch_1 = Sketch()
@@ -75,33 +74,59 @@ def test_body_tessellate(modeler: Modeler):
7574
blocks_2 = body_2.tessellate()
7675
assert "MultiBlock" in str(blocks_2)
7776
assert blocks_2.n_blocks == 3
78-
if not BackendType.is_core_service(modeler.client.backend_type):
79-
assert blocks_2.bounds == pytest.approx(
80-
[0.019999999999999997, 0.04, 0.02000513783799312, 0.03999486216200688, 0.0, 0.03],
81-
rel=1e-6,
82-
abs=1e-8,
83-
)
77+
if modeler._grpc_client.backend_version < (26, 1, 0):
78+
if not BackendType.is_core_service(modeler.client.backend_type):
79+
assert blocks_2.bounds == pytest.approx(
80+
[0.019999999999999997, 0.04, 0.020151922469877917, 0.03984807753012208, 0.0, 0.03],
81+
rel=1e-6,
82+
abs=1e-8,
83+
)
84+
else:
85+
assert blocks_2.bounds == pytest.approx(
86+
[0.019999999999999997, 0.04, 0.020151922469877917, 0.03984807753012208, 0.0, 0.03],
87+
rel=1e-6,
88+
abs=1e-8,
89+
)
8490
else:
85-
assert blocks_2.bounds == pytest.approx(
86-
[0.019999999999999997, 0.04, 0.02000513783799312, 0.03999486216200688, 0.0, 0.03],
87-
rel=1e-6,
88-
abs=1e-8,
89-
)
91+
if not BackendType.is_core_service(modeler.client.backend_type):
92+
assert blocks_2.bounds == pytest.approx(
93+
[0.019999999999999997, 0.04, 0.02000513783799312, 0.03999486216200688, 0.0, 0.03],
94+
rel=1e-6,
95+
abs=1e-8,
96+
)
97+
else:
98+
assert blocks_2.bounds == pytest.approx(
99+
[0.019999999999999997, 0.04, 0.02000513783799312, 0.03999486216200688, 0.0, 0.03],
100+
rel=1e-6,
101+
abs=1e-8,
102+
)
90103

91104
assert blocks_2.center == pytest.approx([0.03, 0.03, 0.015], rel=1e-6, abs=1e-8)
92105

93106
# Tessellate the body merging the individual faces
94107
mesh_2 = body_2.tessellate(merge=True)
95-
if not BackendType.is_core_service(modeler.client.backend_type):
96-
assert "PolyData" in str(mesh_2)
97-
assert mesh_2.n_cells == 392
98-
assert mesh_2.n_points == 396
99-
assert mesh_2.n_arrays == 0
108+
if modeler._grpc_client.backend_version < (26, 1, 0):
109+
if not BackendType.is_core_service(modeler.client.backend_type):
110+
assert "PolyData" in str(mesh_2)
111+
assert mesh_2.n_cells == 72
112+
assert mesh_2.n_points == 76
113+
assert mesh_2.n_arrays == 0
114+
else:
115+
assert "PolyData" in str(mesh_2)
116+
assert mesh_2.n_cells == 72
117+
assert mesh_2.n_points == 76
118+
assert mesh_2.n_arrays == 0
100119
else:
101-
assert "PolyData" in str(mesh_2)
102-
assert mesh_2.n_cells == 392
103-
assert mesh_2.n_points == 396
104-
assert mesh_2.n_arrays == 0
120+
if not BackendType.is_core_service(modeler.client.backend_type):
121+
assert "PolyData" in str(mesh_2)
122+
assert mesh_2.n_cells == 392
123+
assert mesh_2.n_points == 396
124+
assert mesh_2.n_arrays == 0
125+
else:
126+
assert "PolyData" in str(mesh_2)
127+
assert mesh_2.n_cells == 392
128+
assert mesh_2.n_points == 396
129+
assert mesh_2.n_arrays == 0
105130

106131
# Make sure instance body tessellation is the same as original
107132
comp_1_instance = design.add_component("Component_1_Instance", comp_1)
@@ -176,7 +201,6 @@ def test_body_tessellate_with_edges(modeler: Modeler):
176201
@pytest.mark.skipif(
177202
not are_graphics_available(), reason="Skipping due to graphics requirements missing"
178203
)
179-
@pytest.mark.skip(reason="Skipping to promote new CS package")
180204
def test_component_tessellate(modeler: Modeler):
181205
"""Test the component tessellation."""
182206
# Create a sketch
@@ -200,24 +224,44 @@ def test_component_tessellate(modeler: Modeler):
200224
mesh = comp.tessellate()
201225
comp.plot()
202226
assert "PolyData" in str(mesh)
203-
if not BackendType.is_core_service(modeler.client.backend_type):
204-
assert mesh.n_cells == 976
205-
assert mesh.n_arrays == 0
206-
assert mesh.n_points == 996
207-
assert mesh.bounds == pytest.approx(
208-
[-25.0, 25.0, -24.991140278086316, 24.991140278086316, 0.0, 20.0],
209-
rel=1e-6,
210-
abs=1e-8,
211-
)
227+
if modeler._grpc_client.backend_version < (26, 1, 0):
228+
if not BackendType.is_core_service(modeler.client.backend_type):
229+
assert mesh.n_cells == 3280
230+
assert mesh.n_arrays == 0
231+
assert mesh.n_points == 3300
232+
assert mesh.bounds == pytest.approx(
233+
[-25.0, 25.0, -24.999251562526105, 24.999251562526105, 0.0, 20.0],
234+
rel=1e-6,
235+
abs=1e-8,
236+
)
237+
else:
238+
assert mesh.n_cells == 3280
239+
assert mesh.n_arrays == 0
240+
assert mesh.n_points == 3300
241+
assert mesh.bounds == pytest.approx(
242+
[-25.0, 25.0, -24.999251562526105, 24.999251562526105, 0.0, 20.0],
243+
rel=1e-6,
244+
abs=1e-8,
245+
)
212246
else:
213-
assert mesh.n_cells == 976
214-
assert mesh.n_arrays == 0
215-
assert mesh.n_points == 996
216-
assert mesh.bounds == pytest.approx(
217-
[-25.0, 25.0, -24.991140278086316, 24.991140278086316, 0.0, 20.0],
218-
rel=1e-6,
219-
abs=1e-8,
220-
)
247+
if not BackendType.is_core_service(modeler.client.backend_type):
248+
assert mesh.n_cells == 976
249+
assert mesh.n_arrays == 0
250+
assert mesh.n_points == 996
251+
assert mesh.bounds == pytest.approx(
252+
[-25.0, 25.0, -24.991140278086316, 24.991140278086316, 0.0, 20.0],
253+
rel=1e-6,
254+
abs=1e-8,
255+
)
256+
else:
257+
assert mesh.n_cells == 976
258+
assert mesh.n_arrays == 0
259+
assert mesh.n_points == 996
260+
assert mesh.bounds == pytest.approx(
261+
[-25.0, 25.0, -24.991140278086316, 24.991140278086316, 0.0, 20.0],
262+
rel=1e-6,
263+
abs=1e-8,
264+
)
221265

222266

223267
def test_get_design_tessellation(modeler: Modeler):

0 commit comments

Comments
 (0)