diff --git a/doc/changelog.d/3930.added.md b/doc/changelog.d/3930.added.md new file mode 100644 index 00000000000..d3cae934a75 --- /dev/null +++ b/doc/changelog.d/3930.added.md @@ -0,0 +1 @@ +refactor: update geometry tests \ No newline at end of file diff --git a/src/ansys/mapdl/core/mapdl_extended.py b/src/ansys/mapdl/core/mapdl_extended.py index b7d5792f9f5..3681bee8a59 100644 --- a/src/ansys/mapdl/core/mapdl_extended.py +++ b/src/ansys/mapdl/core/mapdl_extended.py @@ -2257,6 +2257,45 @@ def wrinqr(self, key, **kwargs): 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( + "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( + name=name, + extension=extension, + path=path, + entity=entity, + fmt=fmt, + nocl=nocl, + noan=noan, + **kwargs, + ) + class _MapdlExtended(_MapdlCommandExtended): """Extend Mapdl class with new functions""" diff --git a/tests/test_importing_geometries.py b/tests/test_importing_geometries.py index 6308f37502e..6c1b3247888 100644 --- a/tests/test_importing_geometries.py +++ b/tests/test_importing_geometries.py @@ -26,7 +26,6 @@ from ansys.mapdl.core.errors import ( MapdlCommandIgnoredError, - MapdlInvalidRoutineError, MapdlRuntimeError, ) from conftest import ON_CI, ON_LOCAL, ON_UBUNTU, NullContext @@ -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()