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/3930.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
refactor: update geometry tests
39 changes: 39 additions & 0 deletions src/ansys/mapdl/core/mapdl_extended.py
Original file line number Diff line number Diff line change
Expand Up @@ -2257,6 +2257,45 @@
super().wrinqr(key, pname=TMP_VAR, mute=True, **kwargs)
return self.scalar_param(TMP_VAR)

@wraps(_MapdlCore.catiain)
def catiain(self, name="", extension="", path="", blank="", **kwargs):
"""Wrap the ``catiain`` method to take advantage of the gRPC methods."""
if self.platform == "windows":
raise OSError(

Check warning on line 2264 in src/ansys/mapdl/core/mapdl_extended.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/mapdl/core/mapdl_extended.py#L2264

Added line #L2264 was not covered by tests
"The command 'catiain' is not supported on Windows. Use the 'mapdl.cat5in' method instead to import Catia v5 files."
)
return super().catiain(
name=name, extension=extension, path=path, blank=blank, **kwargs
)

@wraps(_MapdlCore.cat5in)
def cat5in(
self,
name="",
extension="",
path="",
entity="",
fmt="",
nocl="",
noan="",
**kwargs,
):
"""Wrap the ``cat5in`` method to take advantage of the gRPC methods."""
if self.platform == "linux":
raise OSError(
"The command 'cat5in' is not supported on Linux. Use the 'mapdl.catiain' method instead to import Catia v4 files."
)
return super().cat5in(

Check warning on line 2288 in src/ansys/mapdl/core/mapdl_extended.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/mapdl/core/mapdl_extended.py#L2288

Added line #L2288 was not covered by tests
name=name,
extension=extension,
path=path,
entity=entity,
fmt=fmt,
nocl=nocl,
noan=noan,
**kwargs,
)


class _MapdlExtended(_MapdlCommandExtended):
"""Extend Mapdl class with new functions"""
Expand Down
27 changes: 22 additions & 5 deletions tests/test_importing_geometries.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

from ansys.mapdl.core.errors import (
MapdlCommandIgnoredError,
MapdlInvalidRoutineError,
MapdlRuntimeError,
)
from conftest import ON_CI, ON_LOCAL, ON_UBUNTU, NullContext
Expand Down Expand Up @@ -159,16 +158,34 @@ def test_readin_x_t(mapdl, cleared):
clear_wkdir_from_cads(mapdl)


@pytest.mark.xfail(ON_CI, reason="MAPDL docker image do not have the CAD libraries")
def test_readin_catiav4(mapdl, cleared):
# Catia v4 is only supported on Linux
if mapdl.platform == "windows":
context = pytest.raises(OSError)
else:
context = NullContext()

with context:
mapdl.catiain(
name="CubeWithHole", # this file is catia v5. We need to change it
extension="CATPart",
path=CADs_path,
)
assert geometry_test_is_correct(mapdl)

clear_wkdir_from_cads(mapdl)


def test_readin_catiav5(mapdl, cleared):
# Catia v5 is only supported on Windows
if ON_CI and mapdl.version <= 22.2 and not ON_UBUNTU:
context = pytest.raises(
MapdlRuntimeError, match="No shared command/library files were found"
)

elif ON_CI:
context = pytest.raises(
MapdlInvalidRoutineError, match=" ~CAT5IN is not a recognized"
)
elif mapdl.platform == "linux":
context = pytest.raises(OSError)

else:
context = NullContext()
Expand Down