Skip to content

Commit 9737dfd

Browse files
committed
fixing failing test and adding test for disco export to facets
1 parent 1ce036d commit 9737dfd

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

tests/_incompatible_tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ backends:
118118
# Export body facets add in 26.1
119119
- tests/integration/test_design.py::test_write_body_facets_on_save[scdocx-None]
120120
- tests/integration/test_design.py::test_write_body_facets_on_save[dsco-DISCO]
121+
- tests/integration/test_design_export.py::test_export_to_disco_with_facets
121122

122123
- version: "24.2"
123124
incompatible_tests:
@@ -230,6 +231,7 @@ backends:
230231
# Export body facets add in 26.1
231232
- tests/integration/test_design.py::test_write_body_facets_on_save[scdocx-None]
232233
- tests/integration/test_design.py::test_write_body_facets_on_save[dsco-DISCO]
234+
- tests/integration/test_design_export.py::test_export_to_disco_with_facets
233235

234236
- version: "25.1"
235237
incompatible_tests:
@@ -311,6 +313,7 @@ backends:
311313
# Export body facets add in 26.1
312314
- tests/integration/test_design.py::test_write_body_facets_on_save[scdocx-None]
313315
- tests/integration/test_design.py::test_write_body_facets_on_save[dsco-DISCO]
316+
- tests/integration/test_design_export.py::test_export_to_disco_with_facets
314317
# NURBS surface creation only available from 26.1 onwards
315318
- tests/integration/test_design.py::test_nurbs_surface_body_creation
316319

@@ -349,5 +352,6 @@ backends:
349352
# Export body facets add in 26.1
350353
- tests/integration/test_design.py::test_write_body_facets_on_save[scdocx-None]
351354
- tests/integration/test_design.py::test_write_body_facets_on_save[dsco-DISCO]
355+
- tests/integration/test_design_export.py::test_export_to_disco_with_facets
352356
# NURBS surface creation only available from 26.1 onwards
353357
- tests/integration/test_design.py::test_nurbs_surface_body_creation

tests/integration/test_design.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3900,7 +3900,7 @@ def test_vertices(modeler: Modeler, tmp_path_factory: pytest.TempPathFactory):
39003900
location = tmp_path_factory.mktemp("test_export_to_scdocx")
39013901
file_location = location / f"{design.name}.scdocx"
39023902
exported_file = design.export_to_scdocx(location, write_body_facets=True)
3903-
assert exported_file.stat().st_size == pytest.approx(216642, 1e-3, 100)
3903+
assert exported_file.stat().st_size == pytest.approx(209996, 1e-3, 100)
39043904
assert file_location.exists()
39053905
design_read = modeler.open_file(file_location)
39063906
assert len(design_read.named_selections) == 5

tests/integration/test_design_export.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,33 @@ def test_export_to_disco(modeler: Modeler, tmp_path_factory: pytest.TempPathFact
218218
location = tmp_path_factory.mktemp("test_export_to_disco")
219219
file_location = location / f"{design.name}.dsco"
220220

221+
# Export to dsco
222+
exported_file = design.export_to_disco(location)
223+
224+
# Checking file size to ensure facets are exported
225+
assert exported_file.stat().st_size == pytest.approx(20464, 1e-3, 100)
226+
227+
# Check the exported file
228+
assert file_location.exists()
229+
230+
# Import the dsco
231+
design_read = modeler.open_file(file_location)
232+
233+
# Check the imported design
234+
_checker_method(design_read, design, True)
235+
236+
237+
def test_export_to_disco_with_facets(modeler: Modeler, tmp_path_factory: pytest.TempPathFactory):
238+
"""Test exporting a design to dsco format with facets only available. in 261"""
239+
"""This is a duplicate to ensure disco exporting is still covered before 261"""
240+
skip_if_spaceclaim(modeler, test_export_to_disco.__name__, "disco export")
241+
# Create a demo design
242+
design = _create_demo_design(modeler)
243+
244+
# Define the location and expected file location
245+
location = tmp_path_factory.mktemp("test_export_to_disco")
246+
file_location = location / f"{design.name}.dsco"
247+
221248
# Export to dsco
222249
exported_file = design.export_to_disco(location, write_body_facets=True)
223250

0 commit comments

Comments
 (0)