Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.d/2199.test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
New test and remove skip
2 changes: 1 addition & 1 deletion src/ansys/geometry/core/designer/design.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def download(
format : DesignFileFormat, default: DesignFileFormat.SCDOCX
Format for the file to save to.
write_body_facets : bool, default: False
Option to write body facets into the saved file. SCDOCX only, 26R1 and later.
Option to write body facets into the saved file. SCDOCX and DISCO only, 26R1 and later.
"""
# Sanity checks on inputs
if isinstance(file_location, str):
Expand Down
12 changes: 8 additions & 4 deletions tests/_incompatible_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ backends:
- tests/integration/test_design_import.py::test_named_selections_after_file_open
- tests/integration/test_design_import.py::test_file_insert_import_named_selections_post_import
# Export body facets add in 26.1
- tests/integration/test_design.py::test_write_body_facets_on_save
- tests/integration/test_design.py::test_write_body_facets_on_save[scdocx-None]
- tests/integration/test_design.py::test_write_body_facets_on_save[dsco-DISCO]

- version: "24.2"
incompatible_tests:
Expand Down Expand Up @@ -203,7 +204,8 @@ backends:
- tests/integration/test_design_import.py::test_named_selections_after_file_open
- tests/integration/test_design_import.py::test_file_insert_import_named_selections_post_import
# Export body facets add in 26.1
- tests/integration/test_design.py::test_write_body_facets_on_save
- tests/integration/test_design.py::test_write_body_facets_on_save[scdocx-None]
- tests/integration/test_design.py::test_write_body_facets_on_save[dsco-DISCO]

- version: "25.1"
incompatible_tests:
Expand Down Expand Up @@ -271,7 +273,8 @@ backends:
- tests/integration/test_design_import.py::test_named_selections_after_file_open
- tests/integration/test_design_import.py::test_file_insert_import_named_selections_post_import
# Export body facets add in 26.1
- tests/integration/test_design.py::test_write_body_facets_on_save
- tests/integration/test_design.py::test_write_body_facets_on_save[scdocx-None]
- tests/integration/test_design.py::test_write_body_facets_on_save[dsco-DISCO]

- version: "25.2"
incompatible_tests:
Expand Down Expand Up @@ -303,4 +306,5 @@ backends:
- tests/integration/test_design_import.py::test_named_selections_after_file_open
- tests/integration/test_design_import.py::test_file_insert_import_named_selections_post_import
# Export body facets add in 26.1
- tests/integration/test_design.py::test_write_body_facets_on_save
- tests/integration/test_design.py::test_write_body_facets_on_save[scdocx-None]
- tests/integration/test_design.py::test_write_body_facets_on_save[dsco-DISCO]
27 changes: 22 additions & 5 deletions tests/integration/test_design.py
Original file line number Diff line number Diff line change
Expand Up @@ -3665,16 +3665,33 @@ def test_component_make_independent(modeler: Modeler):
assert not Accuracy.length_is_equal(comp.bodies[0].volume.m, face.body.volume.m)


def test_write_body_facets_on_save(modeler: Modeler, tmp_path_factory: pytest.TempPathFactory):
@pytest.mark.parametrize(
"file_extension, design_format",
[
("scdocx", None), # For .scdocx files
("dsco", DesignFileFormat.DISCO), # For .dsco files
],
)
def test_write_body_facets_on_save(
modeler: Modeler, tmp_path_factory: pytest.TempPathFactory, file_extension: str, design_format
):
design = modeler.open_file(Path(FILES_DIR, "cars.scdocx"))

# First file without body facets
filepath_no_facets = tmp_path_factory.mktemp("test_design") / "cars_no_facets.scdocx"
design.download(filepath_no_facets)
filepath_no_facets = tmp_path_factory.mktemp("test_design") / f"cars_no_facets.{file_extension}"
if design_format:
design.download(filepath_no_facets, design_format)
else:
design.download(filepath_no_facets)

# Second file with body facets
filepath_with_facets = tmp_path_factory.mktemp("test_design") / "cars_with_facets.scdocx"
design.download(filepath_with_facets, write_body_facets=True)
filepath_with_facets = (
tmp_path_factory.mktemp("test_design") / f"cars_with_facets.{file_extension}"
)
if design_format:
design.download(filepath_with_facets, design_format, write_body_facets=True)
else:
design.download(filepath_with_facets, write_body_facets=True)

# Compare file sizes
size_no_facets = filepath_no_facets.stat().st_size
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/test_design_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,6 @@ def test_import_export_reimport_design_scdocx(
assert len(design.components[0].components[0].bodies) == 3


@pytest.mark.skip(reason="Re-import of x_t files broke")
def test_import_export_reimport_design_x_t(
modeler: Modeler, tmp_path_factory: pytest.TempPathFactory
):
Expand Down Expand Up @@ -441,7 +440,6 @@ def test_import_export_glb(modeler: Modeler, tmp_path_factory: pytest.TempPathFa
assert output_glb_path.stat().st_size > 0, f"GLB file {output_glb_path} is empty."


@pytest.mark.skip(reason="Re-import of x_t files broke")
@pytest.mark.parametrize(
"file_format, extension, original_file, expected_components, expected_bodies",
[
Expand Down
Loading