Skip to content

Commit

Permalink
Adding tests to deprecated commands
Browse files Browse the repository at this point in the history
  • Loading branch information
germa89 committed Dec 15, 2023
1 parent b647d03 commit f01e8f7
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ansys/mapdl/core/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def __init__(self, msg=""):
MapdlException.__init__(self, msg)


class CommandDeprecated(MapdlException):
class CommandDeprecated(MapdlException, DeprecationError):
"""Raised when a command is deprecated"""

def __init__(self, msg=""):
Expand Down
69 changes: 69 additions & 0 deletions tests/test_mapdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from ansys.mapdl import core as pymapdl
from ansys.mapdl.core.commands import CommandListingOutput
from ansys.mapdl.core.errors import (
CommandDeprecated,
IncorrectWorkingDirectory,
MapdlCommandIgnoredError,
MapdlConnectionError,
Expand All @@ -36,6 +37,67 @@
PATH = os.path.dirname(os.path.abspath(__file__))
test_files = os.path.join(PATH, "test_files")

DEPRECATED_COMMANDS = [
"edasmp",
"edbound",
"edbx",
"edcgen",
"edclist",
"edcmore",
"edcnstr",
"edcontact",
"edcrb",
"edcurve",
"eddbl",
"eddc",
"edipart",
"edlcs",
"edmp",
"ednb",
"edndtsd",
"ednrot",
"edpart",
"edpc",
"edsp",
"edweld",
"edadapt",
"edale",
"edbvis",
"edcadapt",
"edcpu",
"edcsc",
"edcts",
"eddamp",
"eddrelax",
"eddump",
"edenergy",
"edfplot",
"edgcale",
"edhgls",
"edhist",
"edhtime",
"edint",
"edis",
"edload",
"edopt",
"edout",
"edpl",
"edpvel",
"edrc",
"edrd",
"edri",
"edrst",
"edrun",
"edshell",
"edsolv",
"edstart",
"edterm",
"edtp",
"edvel",
"edwrite",
"rexport",
]

CMD_BLOCK = """/prep7
! Mat
MP,EX,1,200000
Expand Down Expand Up @@ -157,6 +219,13 @@ def warns_in_cdread_error_log(mapdl, tmpdir):
return any(warns)


@pytest.mark.parametrize("command", DEPRECATED_COMMANDS)
def test_deprecated_commands(mapdl, command):
with pytest.raises(CommandDeprecated):
method = getattr(mapdl, command)
method()


@requires("grpc")
def test_internal_name_grpc(mapdl):
assert str(mapdl._ip) in mapdl.name
Expand Down

0 comments on commit f01e8f7

Please sign in to comment.