diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index 8224f3b373..6aeb4436eb 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -80,7 +80,6 @@ body: description: Run `python --version` to verify your Python version multiple: false options: - - '3.8' - '3.9' - '3.10' - '3.11' diff --git a/.github/ISSUE_TEMPLATE/examples.yml b/.github/ISSUE_TEMPLATE/examples.yml index d2d1cfb715..74a72ac58f 100644 --- a/.github/ISSUE_TEMPLATE/examples.yml +++ b/.github/ISSUE_TEMPLATE/examples.yml @@ -56,7 +56,6 @@ body: description: Run `python --version` to verify your Python version multiple: false options: - - '3.8' - '3.9' - '3.10' - '3.11' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 86504f3c1d..5be12635b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,7 +77,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: ['3.9', '3.10', '3.11', '3.12'] # Only perform wheelhouse builds for macOS when releasing should-release: - ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }} diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index 0ab590c78d..b23e99b34e 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -15,7 +15,7 @@ jobs: steps: - uses: marcoroth/dependabot-bump-together-action@main with: - dependencies: ansys-api-mapdl, ansys-corba, ansys-dpf-core, ansys-mapdl-reader, ansys-math-core, ansys-platform-instancemanagement, ansys-sphinx-theme, ansys-tools-path, autopep8, click, grpcio, imageio, imageio-ffmpeg, importlib-metadata, jupyter_sphinx, jupyterlab, matplotlib, numpy, numpydoc, pandas, pexpect, platformdirs, plotly, protobuf, psutil, pyansys-tools-report, pyansys-tools-versioning, pyiges, pyiges[full], pypandoc, pytest, pytest-cov, pytest-pyvista, pytest-rerunfailures, pytest-sphinx, pythreejs, pyvista, scipy, sphinx, sphinx-autobuild, sphinx-autodoc-typehints, sphinx-copybutton, sphinx-gallery, sphinx-reredirects, sphinxcontrib-websupport, sphinxemoji, tqdm, vtk + dependencies: ansys-api-mapdl, ansys-dpf-core, ansys-mapdl-reader, ansys-math-core, ansys-platform-instancemanagement, ansys-sphinx-theme, ansys-tools-path, autopep8, click, grpcio, imageio, imageio-ffmpeg, importlib-metadata, jupyter_sphinx, jupyterlab, matplotlib, numpy, numpydoc, pandas, pexpect, platformdirs, plotly, protobuf, psutil, pyansys-tools-report, pyansys-tools-versioning, pyiges, pyiges[full], pypandoc, pytest, pytest-cov, pytest-pyvista, pytest-rerunfailures, pytest-sphinx, pythreejs, pyvista, scipy, sphinx, sphinx-autobuild, sphinx-autodoc-typehints, sphinx-copybutton, sphinx-gallery, sphinx-reredirects, sphinxcontrib-websupport, sphinxemoji, tqdm, vtk package_managers: pip directory: / branch: main diff --git a/codecov.yml b/codecov.yml index 5d4ef18f65..024d929842 100644 --- a/codecov.yml +++ b/codecov.yml @@ -2,7 +2,6 @@ ignore: - "src/ansys/mapdl/core/_commands" - "src/ansys/mapdl/core/jupyter.py" - "src/ansys/mapdl/core/mapdl_console.py" - - "src/ansys/mapdl/core/mapdl_corba.py" comment: layout: "diff" diff --git a/pyproject.toml b/pyproject.toml index 1be0ac963c..4dac6b5717 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ name = "ansys-mapdl-core" version = "0.68.dev0" description = "A Python wrapper for Ansys MAPDL." readme = "README.rst" -requires-python = ">=3.8,<3.13" +requires-python = ">=3.9,<3.13" license = {file = "LICENSE"} authors = [ {name = "Ansys, Inc.", email = "pyansys.maintainers@ansys.com"}, @@ -18,7 +18,6 @@ maintainers = [ ] dependencies = [ "ansys-api-mapdl==0.5.1", # supports at least 2020R2 - 2022R1 - "ansys-corba; python_version < '3.9'", "ansys-mapdl-reader>=0.51.7", "ansys-math-core>=0.1.2", "ansys-platform-instancemanagement~=1.0", @@ -48,7 +47,6 @@ classifiers = [ "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Operating System :: MacOS", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -66,8 +64,7 @@ tests = [ "ansys-dpf-core==0.10.0", "autopep8==2.0.4", "matplotlib==3.8.2", - "scipy==1.10.1; python_version < '3.9'", # to support python 3.8 - "scipy==1.11.3; python_version > '3.8'", + "scipy==1.11.3", "pandas==2.1.3", "pyiges[full]==0.3.1", "pytest==7.4.3", @@ -131,7 +128,6 @@ filterwarnings = [ ] markers = [ "skip_grpc: skip tests using grpc", - "corba: skip tests using the CORBA interface", "gui: skip tests that launch the GUI interface", ] testpaths = "tests" @@ -150,10 +146,8 @@ source = ["ansys/pymapdl"] omit = [ # omit commands "ansys/mapdl/core/_commands/*", - # ignore legacy interfaces "ansys/mapdl/core/mapdl_console.py", - "ansys/mapdl/core/mapdl_corba.py", "ansys/mapdl/core/jupyter.py", ] diff --git a/src/ansys/mapdl/core/errors.py b/src/ansys/mapdl/core/errors.py index 023e99b455..7abce6b065 100644 --- a/src/ansys/mapdl/core/errors.py +++ b/src/ansys/mapdl/core/errors.py @@ -119,6 +119,13 @@ def __init__(self, msg=""): RuntimeError.__init__(self, msg) +class DeprecationError(RuntimeError): + """Provides the error for deprecated commands, classes, interfaces, etc""" + + def __init__(self, msg=""): + RuntimeError.__init__(self, msg) + + # handler for protect_grpc def handler(sig, frame): # pragma: no cover """Pass signal to custom interrupt handler.""" diff --git a/src/ansys/mapdl/core/launcher.py b/src/ansys/mapdl/core/launcher.py index ff1620e2ab..f2d96305d3 100644 --- a/src/ansys/mapdl/core/launcher.py +++ b/src/ansys/mapdl/core/launcher.py @@ -31,6 +31,7 @@ from ansys.mapdl.core import LOG from ansys.mapdl.core._version import SUPPORTED_ANSYS_VERSIONS from ansys.mapdl.core.errors import ( + DeprecationError, LockFileException, MapdlDidNotStart, MapdlRuntimeError, @@ -64,7 +65,7 @@ ) CONFIG_FILE = os.path.join(SETTINGS_DIR, "config.txt") -ALLOWABLE_MODES = ["corba", "console", "grpc"] +ALLOWABLE_MODES = ["console", "grpc"] ON_WSL = os.name == "posix" and ( bool(os.environ.get("WSL_DISTRO_NAME", None)) @@ -1015,17 +1016,12 @@ def launch_mapdl( Mode to launch MAPDL. Must be one of the following: - ``'grpc'`` - - ``'corba'`` - ``'console'`` The ``'grpc'`` mode is available on ANSYS 2021R1 or newer and - provides the best performance and stability. The ``'corba'`` - mode is available from v17.0 and newer and is given legacy - support. However only Python up to 3.8 is supported. - This mode requires the additional ``ansys_corba`` module. - Finally, the ``'console'`` mode - is for legacy use only Linux only prior to v17.0. This console - mode is pending depreciation. + provides the best performance and stability. + The ``'console'`` mode is for legacy use only Linux only prior to 2020R2. + This console mode is pending depreciation. Visit :ref:`versions_and_interfaces` for more information. override : bool, optional @@ -1186,14 +1182,9 @@ def launch_mapdl( by default. See :ref:`vpn_issues_troubleshooting` for more information. Defaults to ``False``. - log_broadcast : :class:`bool` - *(Only for CORBA mode)* - Enables a logger to record broadcasted commands. - Defaults to ``False``. - Returns ------- - Union[MapdlGrpc, MapdlConsole, MapdlCorba] + Union[MapdlGrpc, MapdlConsole] An instance of Mapdl. Type depends on the selected ``mode``. Notes @@ -1328,10 +1319,6 @@ def launch_mapdl( >>> mapdl = launch_mapdl(start_instance=False, ip='192.168.1.30', ... port=50001) - Force the usage of the CORBA protocol (not recommended). - - >>> mapdl = launch_mapdl(mode='corba') - Run MAPDL using the console mode (not recommended, and available only on Linux). >>> mapdl = launch_mapdl('/ansys_inc/v194/ansys/bin/ansys194', @@ -1374,6 +1361,11 @@ def launch_mapdl( # Extract arguments: force_intel = kwargs.pop("force_intel", False) broadcast = kwargs.pop("log_broadcast", False) + if broadcast: + raise ValueError( + "The CORBA interface has been deprecated from 0.67." + "Hence this argument is not valid." + ) use_vtk = kwargs.pop("use_vtk", None) # Transferring MAPDL arguments to start_parameters: @@ -1610,8 +1602,9 @@ def launch_mapdl( } ) - if mode in ["console", "corba"]: + if mode == "console": start_parm["start_timeout"] = start_timeout + else: start_parm["ram"] = ram start_parm["override"] = override @@ -1633,24 +1626,7 @@ def launch_mapdl( mapdl = MapdlConsole( loglevel=loglevel, log_apdl=log_apdl, use_vtk=use_vtk, **start_parm ) - elif mode == "corba": - try: - # pending deprecation to ansys-mapdl-corba - from ansys.mapdl.core.mapdl_corba import MapdlCorba - except ModuleNotFoundError: # pragma: no cover - raise ModuleNotFoundError( - "To use this feature, install the MAPDL CORBA package" - " with:\n\npip install ansys_corba" - ) from None - - mapdl = MapdlCorba( - loglevel=loglevel, - log_apdl=log_apdl, - log_broadcast=broadcast, - verbose=verbose_mapdl, - use_vtk=use_vtk, - **start_parm, - ) + elif mode == "grpc": port, actual_run_location, process = launch_grpc( port=port, @@ -1713,19 +1689,13 @@ def check_mode(mode, version): elif os.name == "posix": raise VersionError("gRPC mode requires MAPDL 2021R1 or newer.") elif mode == "corba": - warnings.warn( - "The CORBA interface is going to be deprecated with the version" + raise DeprecationError( + "The CORBA interface has been deprecated with the" " v0.67 release. Please use the gRPC interface instead.\n" "For more information visit: " "https://mapdl.docs.pyansys.com/version/0.66/getting_started/versioning.html#corba-interface" ) - if version < 170: - raise VersionError("CORBA AAS mode requires MAPDL v17.0 or newer.") - if version >= 211: - warnings.warn( - "CORBA AAS mode not recommended in MAPDL 2021R1 or newer.\n" - "Recommend using gRPC mode instead." - ) + elif mode == "console": if os.name == "nt": raise ValueError("Console mode requires Linux.") @@ -1746,18 +1716,17 @@ def check_mode(mode, version): elif version == 202 and os.name == "nt": # Windows supports it as of 2020R2 mode = "grpc" - elif version >= 170: - mode = "corba" else: if os.name == "nt": raise VersionError( "Running MAPDL as a service requires " - "v17.0 or greater on Windows." + "MAPDL 2020R2 or greater on Windows." ) mode = "console" if version < 130: warnings.warn("MAPDL as a service has not been tested on MAPDL < v13") + mode = "console" return mode diff --git a/src/ansys/mapdl/core/mapdl.py b/src/ansys/mapdl/core/mapdl.py index bb8e5bb3d4..00fba5eec1 100644 --- a/src/ansys/mapdl/core/mapdl.py +++ b/src/ansys/mapdl/core/mapdl.py @@ -328,7 +328,7 @@ def print_com(self, value): @property def connection(self): - """Return the type of connection to the instance, namely: grpc, corba or console.""" + """Return the type of connection to the instance, namely: grpc, or console.""" return self._mode @property diff --git a/src/ansys/mapdl/core/mapdl_corba.py b/src/ansys/mapdl/core/mapdl_corba.py deleted file mode 100644 index 0f611419fe..0000000000 --- a/src/ansys/mapdl/core/mapdl_corba.py +++ /dev/null @@ -1,478 +0,0 @@ -"""CORBA implementation of the MAPDL interface.""" -import atexit -import os -import re -import subprocess -import sys -import time -import warnings -import weakref - -from ansys.mapdl.core.errors import MapdlExitedError, MapdlRuntimeError -from ansys.mapdl.core.mapdl import _MapdlCore -from ansys.mapdl.core.misc import random_string, requires_package, threaded - -if sys.version_info[1] > 8: - raise ImportError( - "The CORBA interface is only supported for Python 3.8" " and earlier" - ) - -from ansys_corba import CORBA - -INSTANCES = [] - - -@atexit.register -def _cleanup(): - for instance in INSTANCES: - try: - if instance() is not None: - instance().exit() - except: - pass - - -def tail(filename, nlines): - """Read the last nlines of a text file""" - with open(filename) as qfile: - qfile.seek(0, os.SEEK_END) - endf = position = qfile.tell() - linecnt = 0 - while position >= 0: - qfile.seek(position) - next_char = qfile.read(1) - if next_char == "\n" and position != endf - 1: - linecnt += 1 - - if linecnt == nlines: - break - position -= 1 - - if position < 0: - qfile.seek(0) - - return qfile.read() - - -def launch_corba( - exec_file=None, - run_location=None, - jobname=None, - nproc=None, - verbose=None, - additional_switches="", - start_timeout=60, - **kwargs, # ignore extra kwargs -): - """Start MAPDL in AAS mode. - - Notes - ----- - The CORBA interface is likely to fail on computers with multiple - network adapters. The ANSYS RPC isn't smart enough to determine - the right adapter and will likely try to communicate on the wrong - IP. - """ - # Using stored parameters so launch command can be run from a - # cached state (when launching the GUI) - - if verbose is not None: - warnings.warn( - "The ``verbose`` argument is deprecated and will be removed in a future release. " - "Use a logger instead. See :ref:`api_logging` for more details.", - DeprecationWarning, - ) - - # can't run /BATCH in windows, so we trick it using "-b" and - # provide a dummy input file - if os.name == "nt": - # must be a random filename to avoid conflicts with other - # potential instances - tmp_file = "%s.inp" % random_string(10) - with open(os.path.join(run_location, tmp_file), "w") as f: - f.write("FINISH") - additional_switches += " -b -i %s -o out.txt" % tmp_file - - # command must include "aas" flag to start MAPDL server - command = '"%s" -aas -j %s -np %d %s' % ( - exec_file, - jobname, - nproc, - additional_switches, - ) - - # remove any broadcast files - broadcast_file = os.path.join(run_location, "mapdl_broadcasts.txt") - if os.path.isfile(broadcast_file): - os.remove(broadcast_file) - - process = subprocess.Popen( - command, - shell=True, - cwd=run_location, - stdin=subprocess.DEVNULL, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - ) - - # listen for broadcast file - telapsed = 0 - tstart = time.time() - started_rpc = False - while telapsed < start_timeout and not started_rpc: - try: - if os.path.isfile(broadcast_file): - broadcast = open(broadcast_file).read() - # see if connection to RPC has been made - rpc_txt = "visited:collaborativecosolverunitior-set:" - started_rpc = rpc_txt in broadcast - - time.sleep(0.1) - telapsed = time.time() - tstart - - except KeyboardInterrupt: - raise KeyboardInterrupt - - # exit if timed out - if not started_rpc: - err_str = "Unable to start ANSYS within %.1f seconds" % start_timeout - if os.path.isfile(broadcast_file): - broadcast = open(broadcast_file).read() - err_str += "\n\nLast broadcast:\n%s" % broadcast - raise TimeoutError(err_str) - - # return CORBA key - keyfile = os.path.join(run_location, "aaS_MapdlId.txt") - return open(keyfile).read(), process - - -class MapdlCorba(_MapdlCore): - """CORBA implementation of the MAPDL interface - - Parameters - ---------- - corba_key : str - CORBA key used to start the corba interface - - start : dict - Additional start parameters to be passed to launcher when - launching the gui interactively. - - exec_file, run_location, jobname='file', nproc=2, - additional_switches='', timeout - - verbose : bool - Print all output from MAPDL to Python. Useful for debugging. - - .. deprecated:: v0.65.0 - The ``verbose_mapdl`` argument is deprecated and will be removed in a future release. - Use a logger instead. See :ref:`api_logging` for more details. - - log_file : bool, optional - Copy the log to a file called `logs.log` located where the - python script is executed. Default ``True``. - - print_com : bool, optional - Print the command ``/COM`` arguments to the standard output. - Default ``False``. - """ - - def __init__( - self, - loglevel="INFO", - log_apdl=None, - use_vtk=True, - log_file=True, - log_broadcast=False, - verbose=None, - **start_parm, - ): - """Open a connection to MAPDL via a CORBA interface""" - super().__init__( - loglevel=loglevel, - use_vtk=use_vtk, - log_apdl=log_apdl, - log_file=log_file, - log_broadcast=False, - **start_parm, - ) - - if verbose is not None: - warnings.warn( - "The ``verbose`` argument is deprecated and will be removed in a future release. " - "Use a logger instead. See :ref:`api_logging` for more details.", - DeprecationWarning, - ) - elif verbose is None: - verbose = False - - self._mode = "corba" - self._broadcast_logger = None - self._server = None - self._outfile = None - self._log_broadcast = log_broadcast - self._launch(start_parm, verbose) - super().__init__( - loglevel=loglevel, use_vtk=use_vtk, log_apdl=log_apdl, **start_parm - ) - - # critical for collection - INSTANCES.append(weakref.ref(self)) - self._corba_key = None - - @property - @requires_package("ansys.mapdl.reader", softerror=True) - @requires_package("pyvista", softerror=True) - def mesh(self): - """Mesh information. - - Returns - ------- - :class:`Mapdl.Mesh ` - - Examples - -------- - Return an array of the active nodes - - >>> mapdl.mesh.nodes - array([[ 1., 0., 0.], - [ 2., 0., 0.], - [ 3., 0., 0.], - [ 4., 0., 0.], - [ 5., 0., 0.], - [ 6., 0., 0.], - [ 7., 0., 0.], - [ 8., 0., 0.], - [ 9., 0., 0.], - [10., 0., 0.]]) - - Return an array of the node numbers of the active nodes - - >>> mapdl.mesh.nnum - array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], dtype=int32) - - Simply query and print the geometry - - >>> print(mapdl.mesh) - ANSYS Mapdl Mesh - Number of Nodes: 321 - Number of Elements: 40 - Number of Element Types: 1 - Number of Node Components: 2 - Number of Element Components: 2 - - Access the geometry as a VTK object - - >>> mapdl.mesh.grid - - """ - return self._mesh - - def _launch(self, start_parm, verbose): - """Launch CORBA.""" - corba_key, process = launch_corba(verbose=verbose, **start_parm) - self._corba_key = corba_key - self._mapdl_process = process - - orb = CORBA.ORB_init() - self._server = orb.string_to_object(corba_key) - - # verify you can connect to MAPDL - try: - self._server.getComponentName() - except: - raise MapdlRuntimeError("Unable to connect to APDL server") - - # must set to non-interactive in linux - if os.name == "posix": - self._batch() - - self._log.debug( - "Connected to ANSYS using CORBA interface with key %s", corba_key - ) - - # separate logger for broadcast file - if self._log_broadcast: - self._broadcast_logger = self._start_broadcast_logger() - - @property - def _broadcast_file(self): - return os.path.join(self.directory, "mapdl_broadcasts.txt") - - @threaded - def _start_broadcast_logger(self, update_rate=1.0): - """Separate logger using broadcast_file""" - # listen to broadcast file - loadstep = 0 - overall_progress = 0 - try: - old_tail = "" - old_size = 0 - while not self._exited: - new_size = os.path.getsize(self._broadcast_file) - if new_size != old_size: - old_size = new_size - new_tail = tail(self._broadcast_file, 4) - if new_tail != old_tail: - lines = new_tail.split(">>") - for line in lines: - line = line.strip().replace("< loadstep: - loadstep = n - overall_progress = 0 - self._log.info(line) - elif "overall-progress" in line: - n = int(re.search(r"\d+", line).group()) - if n > overall_progress: - overall_progress = n - self._log.info(line) - old_tail = new_tail - time.sleep(update_rate) - except Exception as e: - pass - - def exit(self, close_log=True, timeout=3): - """Exit MAPDL process""" - if self._exited: - return - - # self._log.debug('Exiting ANSYS') - if self._server is not None: - # attempt to cache final path and lockfile before exiting - try: - path = self.directory - lockfile = self._lockfile - except: - pass - - try: - self.run("/EXIT") - except: - pass - - try: - self._server.terminate() - except: - pass - self._server = None - - if close_log: - self._close_apdl_log() - - # wait for lockfile to be removed - if timeout: - tstart = time.time() - if lockfile is not None: - while os.path.isfile(lockfile): - time.sleep(0.05) - telap = tstart - time.time() - if telap > timeout: - return 1 - - try: - self._remove_lockfile() - except: - pass - - self._exited = True - - def _remove_lockfile(self): - """Removes lockfile""" - if os.path.isfile(self._lockfile): - try: - os.remove(self._lockfile) - except: - pass - - def _run(self, command, **kwargs): - """Sends a command to the mapdl server via the CORBA interface""" - self._reset_cache() - if self._server is None: - raise MapdlExitedError("ANSYS exited") - - # cleanup command - command = command.strip() - if not command: - raise ValueError("Cannot run empty command") - - if command[:4].lower() == "cdre": - with self.non_interactive: - self.run(command) - return self._response - - if command[:4].lower() == "/com": - split_command = command.split(",") - if len(split_command) < 2: - return "" - elif not split_command[1]: - return "" - elif split_command[1]: - if not split_command[1].strip(): - return "" - - # /OUTPUT not redirected properly in corba - if command[:4].lower() == "/out": - items = command.split(",") - if len(items) > 1: # redirect to file - if len(items) > 2: - if items[2].strip(): - filename = ".".join(items[1:3]).strip() - else: - filename = ".".join(items[1:2]).strip() - else: - filename = items[1] - - if filename: - if os.path.basename(filename) == filename: - filename = os.path.join(self.directory, filename) - self._output = filename - if len(items) == 5: - if items[4].lower().strip() == "append": - self._outfile = open(filename, "a") - else: - self._outfile = open(filename, "w") - else: - self._close_output() - - else: - self._close_output() - return "" - - # include error checking - text = "" - additional_text = "" - - self._log.debug("Running command %s", command) - text = self._server.executeCommandToString(command) - - # print suppressed output - additional_text = self._server.executeCommandToString("/GO") - - # return text, additional_text - if text == additional_text: - additional_text = "" - - response = "%s\n%s" % (text, additional_text) - - if self._outfile is not None: - self._outfile.write(response) - - return response - - def _close_output(self): - """Closes the output file""" - self._output = "" - if self._outfile: - self._outfile.close() - self._outfile = None - - @property - def name(self): - """Instance unique identifier.""" - if not self._name: - if hasattr(self, "_corba_key"): - self._name = f"CORBA_PID_{self._corba_key}" - self._name = f"CORBA_INSTANCE_{id(self)}" - return self._name diff --git a/src/ansys/mapdl/core/misc.py b/src/ansys/mapdl/core/misc.py index e30b3ddaa8..82eb4c4bf4 100644 --- a/src/ansys/mapdl/core/misc.py +++ b/src/ansys/mapdl/core/misc.py @@ -10,7 +10,6 @@ import re import socket import string -import sys import tempfile from threading import Thread from typing import Union @@ -119,9 +118,6 @@ def __init__(self, core, optional=None, additional=None, **kwargs): if os.name == "posix": self.core.extend(["pexpect"]) - if self.optional is not None and sys.version_info[1] < 9: - self.optional.append("ansys_corba") - # Information about the GPU - bare except in case there is a rendering # bug that the user is trying to report. if self.kwargs.get("gpu", False) and _HAS_PYVISTA: diff --git a/tests/conftest.py b/tests/conftest.py index 70732888c8..7b6d00ac09 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -128,9 +128,6 @@ def requires(requirement: str): elif "console" == requirement: return pytest.mark.console - elif "corba" == requirement: - return pytest.mark.corba - else: return requires_dependency(requirement) @@ -229,9 +226,6 @@ def pytest_configure(config): def pytest_addoption(parser): - parser.addoption( - "--corba", action="store_true", default=False, help="run CORBA tests" - ) parser.addoption( "--console", action="store_true", @@ -248,13 +242,6 @@ def pytest_addoption(parser): def pytest_collection_modifyitems(config, items): - if not config.getoption("--corba"): - # --corba given in cli: run CORBA interface tests - skip_corba = pytest.mark.skip(reason="need --corba option to run") - for item in items: - if "corba" in item.keywords: - item.add_marker(skip_corba) - if not config.getoption("--console"): # --console given in cli: run console interface tests skip_console = pytest.mark.skip(reason="need --console option to run") @@ -371,7 +358,7 @@ def mapdl_console(request): ) ansys_base_paths = get_available_ansys_installations() - # find a valid version of corba + # find a valid version of console console_path = None for version in ansys_base_paths: version = abs(version) @@ -402,41 +389,6 @@ def mapdl_console(request): mapdl.prep7() -@pytest.fixture(scope="session") -def mapdl_corba(request): - ansys_base_paths = get_available_ansys_installations() - - # find a valid version of corba - corba_path = None - for version in ansys_base_paths: - version = abs(version) - if version >= 170 and version < 202: - corba_path = find_ansys(str(version))[0] - - if corba_path is None: - raise MapdlRuntimeError( - '"-corba" testing option unavailable.' - "No local CORBA compatible MAPDL installation found. " - "Valid versions are ANSYS 17.0 up to 2020R2." - ) - - mapdl = launch_mapdl(corba_path) - from ansys.mapdl.core.mapdl_corba import MapdlCorba - - assert isinstance(mapdl, MapdlCorba) - mapdl._show_matplotlib_figures = False # CI: don't show matplotlib figures - - # using yield rather than return here to be able to test exit - yield mapdl - - # verify mapdl exits - mapdl.exit() - assert mapdl._exited - assert "MAPDL exited" in str(mapdl) - with pytest.raises(MapdlExitedError): - mapdl.prep7() - - @pytest.fixture(scope="session") def mapdl(request, tmpdir_factory): # don't use the default run location as tests run multiple unit testings diff --git a/tests/test_console.py b/tests/test_console.py index ee09169d52..7d26310dd9 100644 --- a/tests/test_console.py +++ b/tests/test_console.py @@ -589,7 +589,7 @@ def test_load_table(mapdl_console): assert np.allclose(mapdl_console.parameters["my_conv"], my_conv[:, -1]) -def test_mode_corba(mapdl_console): +def test_mode_console(mapdl_console): assert mapdl_console.mode == "console" assert not mapdl_console.is_grpc assert not mapdl_console.is_corba diff --git a/tests/test_corba.py b/tests/test_corba.py deleted file mode 100644 index 64324107bc..0000000000 --- a/tests/test_corba.py +++ /dev/null @@ -1,587 +0,0 @@ -"""Test legacy MAPDL CORBA interface. - -This has been copied from test_mapdl.py - -""" -import os -import time - -import numpy as np -import pytest - -from conftest import has_dependency, requires - -# skip entire module unless --corba is enabled -pytestmark = requires("corba") - -if has_dependency("pyvista"): - import pyvista - -if has_dependency("ansys-mapdl-reader"): - from ansys.mapdl.reader import examples - -from ansys.mapdl import core as pymapdl -from ansys.mapdl.core.errors import MapdlRuntimeError - - -@pytest.fixture(scope="function") -def cleared(mapdl_corba): - mapdl_corba.finish() - # *MUST* be NOSTART. With START fails after 20 calls... - mapdl_corba.clear("NOSTART") - mapdl_corba.prep7() - yield - - -@pytest.fixture(scope="function") -def make_block(mapdl_corba, cleared): - mapdl_corba.block(0, 1, 0, 1, 0, 1) - mapdl_corba.et(1, 186) - mapdl_corba.esize(0.25) - mapdl_corba.vmesh("ALL") - - -def test_jobname(mapdl_corba, cleared): - jobname = "abcdefg" - assert mapdl_corba.jobname != jobname - mapdl_corba.finish() - mapdl_corba.filname(jobname) - assert mapdl_corba.jobname == jobname - - other_jobname = "gfedcba" - mapdl_corba.jobname = other_jobname - assert mapdl_corba.jobname == other_jobname - - -def test_empty(mapdl_corba): - with pytest.raises(ValueError): - mapdl_corba.run("") - - -def test_str(mapdl_corba): - assert "ANSYS Mechanical" in str(mapdl_corba) - - -def test_version(mapdl_corba): - assert isinstance(mapdl_corba.version, float) - - -def test_comment(cleared, mapdl_corba): - comment = "Testing..." - resp = mapdl_corba.com(comment) - assert comment in resp - - -def test_basic_command(cleared, mapdl_corba): - resp = mapdl_corba.finish() - assert "ROUTINE COMPLETED" in resp - - -def test_allow_ignore(mapdl_corba): - mapdl_corba.clear() - mapdl_corba.allow_ignore = False - assert mapdl_corba.allow_ignore is False - with pytest.raises(pymapdl.errors.MapdlInvalidRoutineError): - mapdl_corba.k() - - # Does not create keypoints and yet does not raise error - mapdl_corba.allow_ignore = True - assert mapdl_corba.allow_ignore is True - mapdl_corba.k() - assert mapdl_corba.geometry.n_keypoint == 0 - - -def test_e(mapdl_corba, cleared): - mapdl_corba.et("", 183) - n0 = mapdl_corba.n("", 0, 0, 0) - n1 = mapdl_corba.n("", 1, 0, 0) - n2 = mapdl_corba.n("", 1, 1, 0) - n3 = mapdl_corba.n("", 0, 1, 1) - n4 = mapdl_corba.n("", 0, 1, -1) - e0 = mapdl_corba.e(n0, n1, n2, n3) - assert e0 == 1 - e1 = mapdl_corba.e(n0, n1, n2, n4) - assert e1 == 2 - - -def test_et(mapdl_corba, cleared): - n_plane183 = mapdl_corba.et("", "PLANE183") - assert n_plane183 == 1 - n_compare = int(mapdl_corba.get_value("ETYP", item1="NUM", it1num="MAX")) - assert n_plane183 == n_compare - n_plane183 = mapdl_corba.et(17, "PLANE183") - assert n_plane183 == 17 - - -def test_k(cleared, mapdl_corba): - k0 = mapdl_corba.k("", 0, 0, 0) - assert k0 == 1 - k1 = mapdl_corba.k(2, 0, 0, 1) - assert k1 == 2 - - -def test_l(cleared, mapdl_corba): - k0 = mapdl_corba.k("", 0, 0, 0) - k1 = mapdl_corba.k("", 1, 0, 0) - l0 = mapdl_corba.l(k0, k1) - assert l0 == 1 - - -def test_a(cleared, mapdl_corba): - k0 = mapdl_corba.k("", 0, 0, 0) - k1 = mapdl_corba.k("", 1, 0, 0) - k2 = mapdl_corba.k("", 0, 1, 0) - a0 = mapdl_corba.a(k0, k1, k2) - assert a0 == 1 - - -def test_v(cleared, mapdl_corba): - k0 = mapdl_corba.k("", 0, 0, 0) - k1 = mapdl_corba.k("", 1, 0, 0) - k2 = mapdl_corba.k("", 0, 1, 0) - k3 = mapdl_corba.k("", 0, 0, 1) - v0 = mapdl_corba.v(k0, k1, k2, k3) - assert v0 == 1 - - -def test_n(cleared, mapdl_corba): - n0 = mapdl_corba.n("", 0, 0, 0) - assert n0 == 1 - n1 = mapdl_corba.n(2, 0, 0, 1) - assert n1 == 2 - - -def test_bsplin(cleared, mapdl_corba): - k0 = mapdl_corba.k("", 0, 0, 0) - k1 = mapdl_corba.k("", 1, 0, 0) - k2 = mapdl_corba.k("", 2, 1, 0) - l0 = mapdl_corba.bsplin(k0, k1, k2) - assert l0 == 1 - - -def test_a(cleared, mapdl_corba): - k0 = mapdl_corba.k("", 0, 0, 0) - k1 = mapdl_corba.k("", 1, 0, 0) - k2 = mapdl_corba.k("", 1, 1, 0) - k3 = mapdl_corba.k("", 0, 1, 0) - a0 = mapdl_corba.a(k0, k1, k2, k3) - assert a0 == 1 - - -def test_al(cleared, mapdl_corba): - k0 = mapdl_corba.k("", 0, 0, 0) - k1 = mapdl_corba.k("", 1, 0, 0) - k2 = mapdl_corba.k("", 1, 1, 0) - k3 = mapdl_corba.k("", 0, 1, 0) - l0 = mapdl_corba.l(k0, k1) - l1 = mapdl_corba.l(k1, k2) - l2 = mapdl_corba.l(k2, k3) - l3 = mapdl_corba.l(k3, k0) - a0 = mapdl_corba.al(l0, l1, l2, l3) - assert a0 == 1 - - -def test_invalid_area(mapdl_corba): - with pytest.raises(MapdlRuntimeError): - mapdl_corba.a(0, 0, 0, 0) - - -# def test_invalid_input(mapdl_corba): -# with pytest.raises(FileNotFoundError): -# mapdl_corba.input('thisisnotafile') - - -@requires("xserver") -def test_kplot(cleared, mapdl_corba, tmpdir): - mapdl_corba.k("", 0, 0, 0) - mapdl_corba.k("", 1, 0, 0) - mapdl_corba.k("", 1, 1, 0) - mapdl_corba.k("", 0, 1, 0) - - filename = str(tmpdir.mkdir("tmpdir").join("tmp.png")) - cpos = mapdl_corba.kplot(savefig=filename) - assert cpos is None - assert os.path.isfile(filename) - - mapdl_corba.kplot(knum=True, vtk=False) # make sure legacy still works - - -@requires("xserver") -def test_aplot(cleared, mapdl_corba): - k0 = mapdl_corba.k("", 0, 0, 0) - k1 = mapdl_corba.k("", 1, 0, 0) - k2 = mapdl_corba.k("", 1, 1, 0) - k3 = mapdl_corba.k("", 0, 1, 0) - l0 = mapdl_corba.l(k0, k1) - l1 = mapdl_corba.l(k1, k2) - l2 = mapdl_corba.l(k2, k3) - l3 = mapdl_corba.l(k3, k0) - mapdl_corba.al(l0, l1, l2, l3) - mapdl_corba.aplot(show_area_numbering=True) - mapdl_corba.aplot(color_areas=True, show_lines=True, show_line_numbering=True) - - mapdl_corba.aplot(quality=100) - mapdl_corba.aplot(quality=-1) - - # and legacy as well - mapdl_corba.aplot(vtk=False) - - -@requires("xserver") -@pytest.mark.parametrize("vtk", [True, False]) -def test_vplot(cleared, mapdl_corba, vtk): - mapdl_corba.block(0, 1, 0, 1, 0, 1) - mapdl_corba.vplot(vtk=vtk, color_areas=True) - - -def test_keypoints(cleared, mapdl_corba): - assert mapdl_corba.geometry.n_keypoint == 0 - kps = [[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]] - - i = 1 - knum = [] - for x, y, z in kps: - mapdl_corba.k(i, x, y, z) - knum.append(i) - i += 1 - - assert mapdl_corba.geometry.n_keypoint == 4 - assert np.allclose(kps, mapdl_corba.geometry.keypoints) - assert np.allclose(knum, mapdl_corba.geometry.knum) - - -def test_lines(cleared, mapdl_corba): - assert mapdl_corba.geometry.n_line == 0 - - k0 = mapdl_corba.k("", 0, 0, 0) - k1 = mapdl_corba.k("", 1, 0, 0) - k2 = mapdl_corba.k("", 1, 1, 0) - k3 = mapdl_corba.k("", 0, 1, 0) - l0 = mapdl_corba.l(k0, k1) - l1 = mapdl_corba.l(k1, k2) - l2 = mapdl_corba.l(k2, k3) - l3 = mapdl_corba.l(k3, k0) - - lines = mapdl_corba.geometry.lines - assert isinstance(lines, pyvista.PolyData) - assert np.allclose(mapdl_corba.geometry.lnum, [l0, l1, l2, l3]) - assert mapdl_corba.geometry.n_line == 4 - - -@requires("xserver") -def test_lplot(cleared, mapdl_corba, tmpdir): - mapdl_corba.lplot(vtk=True) - - k0 = mapdl_corba.k("", 0, 0, 0) - k1 = mapdl_corba.k("", 1, 0, 0) - k2 = mapdl_corba.k("", 1, 1, 0) - k3 = mapdl_corba.k("", 0, 1, 0) - mapdl_corba.l(k0, k1) - mapdl_corba.l(k1, k2) - mapdl_corba.l(k2, k3) - mapdl_corba.l(k3, k0) - - filename = str(tmpdir.mkdir("tmpdir").join("tmp.png")) - cpos = mapdl_corba.lplot(show_keypoint_numbering=True, savefig=filename) - assert cpos is None - assert os.path.isfile(filename) - - mapdl_corba.lplot(vtk=False) # make sure legacy still works - - -def test_logging(mapdl_corba, tmpdir): - filename = str(tmpdir.mkdir("tmpdir").join("tmp.inp")) - if mapdl_corba._log is None: - mapdl_corba.open_apdl_log(filename, mode="w") - mapdl_corba._close_apdl_log() - - # test append mode - mapdl_corba.open_apdl_log(filename, mode="a") - - # don't allow to double log - with pytest.raises(MapdlRuntimeError): - mapdl_corba.open_apdl_log(filename, mode="w") - - mapdl_corba.prep7() - mapdl_corba.k(1, 0, 0, 0) - mapdl_corba.k(2, 1, 0, 0) - mapdl_corba.k(3, 1, 1, 0) - mapdl_corba.k(4, 0, 1, 0) - - mapdl_corba._apdl_log.flush() - - out = open(mapdl_corba._apdl_log.name).read().strip().split()[-5:] - assert "PREP7" in out[0] - assert "K,4,0,1,0" in out[-1] - - -def test_nodes(tmpdir, cleared, mapdl_corba): - mapdl_corba.n(1, 1, 1, 1) - mapdl_corba.n(11, 10, 1, 1) - mapdl_corba.fill(1, 11, 9) - - basename = "tmp.nodes" - filename = str(tmpdir.mkdir("tmpdir").join(basename)) - if mapdl_corba._local: - mapdl_corba.nwrite(filename) - else: - mapdl_corba.nwrite(basename) - mapdl_corba.download(basename, filename) - - assert np.allclose(mapdl_corba.mesh.nodes, np.loadtxt(filename)[:, 1:]) - assert mapdl_corba.mesh.n_node == 11 - assert np.allclose(mapdl_corba.mesh.nnum, range(1, 12)) - - # test clear mapdl - mapdl_corba.clear() - assert not mapdl_corba.mesh.nodes.size - assert not mapdl_corba.mesh.n_node - assert not mapdl_corba.mesh.nnum.size - - -def test_enum(mapdl_corba, make_block): - assert mapdl_corba.mesh.n_elem - assert np.allclose(mapdl_corba.mesh.enum, range(1, mapdl_corba.mesh.n_elem + 1)) - - -@pytest.mark.parametrize("nnum", [True, False]) -@requires("xserver") -def test_nplot_vtk(cleared, mapdl_corba, nnum): - mapdl_corba.nplot() - - mapdl_corba.n(1, 0, 0, 0) - mapdl_corba.n(11, 10, 0, 0) - mapdl_corba.fill(1, 11, 9) - mapdl_corba.nplot(vtk=True, nnum=nnum, background="w", color="k") - - -@requires("xserver") -def test_nplot(cleared, mapdl_corba): - mapdl_corba.n(1, 0, 0, 0) - mapdl_corba.n(11, 10, 0, 0) - mapdl_corba.fill(1, 11, 9) - mapdl_corba.nplot(vtk=False, background="w", color="k") - - -def test_elements(cleared, mapdl_corba): - mapdl_corba.et(1, 185) - - # two basic cells - cell1 = [ - [0, 0, 0], - [1, 0, 0], - [1, 1, 0], - [0, 1, 0], - [0, 0, 1], - [1, 0, 1], - [1, 1, 1], - [0, 1, 1], - ] - - cell2 = [ - [0, 0, 2], - [1, 0, 2], - [1, 1, 2], - [0, 1, 2], - [0, 0, 3], - [1, 0, 3], - [1, 1, 3], - [0, 1, 3], - ] - - with mapdl_corba.non_interactive: - for cell in [cell1, cell2]: - for x, y, z in cell: - mapdl_corba.n(x=x, y=y, z=z) - - mapdl_corba.e(*list(range(1, 9))) - mapdl_corba.e(*list(range(9, 17))) - expected = np.array( - [ - [1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8], - [1, 1, 1, 1, 0, 0, 0, 0, 2, 0, 9, 10, 11, 12, 13, 14, 15, 16], - ] - ) - if "Grpc" in str(type(mapdl_corba)): - # no element number in elements - expected[:, 8] = 0 - - assert np.allclose(np.array(mapdl_corba.mesh.elem), expected) - - -# this is not that stable -@pytest.mark.parametrize( - "parm", - ( - "my_string", - 1, - 10.0, - # [1, 2, 3], - # [[1, 2, 3], [1, 2, 3]], - # np.random.random((10000)), # fails on gRPC at 100000 - np.random.random((10, 3)), - np.random.random((10, 3, 3)), - ), -) -def test_set_get_parameters(mapdl_corba, parm): - parm_name = pymapdl.misc.random_string(20) - mapdl_corba.parameters[parm_name] = parm - if isinstance(parm, str): - assert mapdl_corba.parameters[parm_name] == parm - else: - assert np.allclose(mapdl_corba.parameters[parm_name], parm) - - -def test_set_parameters_arr_to_scalar(mapdl_corba, cleared): - mapdl_corba.parameters["PARM"] = np.arange(10) - mapdl_corba.parameters["PARM"] = 2 - - -def test_set_parameters_string_spaces(mapdl_corba): - with pytest.raises(ValueError): - mapdl_corba.parameters["PARM"] = "string with spaces" - - -def test_builtin_parameters(mapdl_corba, cleared): - mapdl_corba.prep7() - assert mapdl_corba.parameters.routine == "PREP7" - - mapdl_corba.units("SI") - assert mapdl_corba.parameters.units == "SI" - - assert isinstance(mapdl_corba.parameters.revision, float) - - if os.name == "posix": - assert "LIN" in mapdl_corba.parameters.platform - - mapdl_corba.csys(1) - assert mapdl_corba.parameters.csys == 1 - - mapdl_corba.dsys(1) - assert mapdl_corba.parameters.dsys == 1 - - mapdl_corba.esys(0) - assert mapdl_corba.parameters.esys == 0 - assert mapdl_corba.parameters.material == 1 - assert mapdl_corba.parameters.section == 1 - assert mapdl_corba.parameters.real == 1 - - -@requires("xserver") -def test_eplot(mapdl_corba, make_block): - init_elem = mapdl_corba.mesh.n_elem - mapdl_corba.aplot() # check aplot and verify it doesn't mess up the element plotting - mapdl_corba.eplot(show_node_numbering=True, background="w", color="b") - mapdl_corba.aplot() # check aplot and verify it doesn't mess up the element plotting - assert mapdl_corba.mesh.n_elem == init_elem - - -@requires("xserver") -def test_eplot_screenshot(mapdl_corba, make_block, tmpdir): - filename = str(tmpdir.mkdir("tmpdir").join("tmp.png")) - mapdl_corba.eplot( - background="w", - show_edges=True, - smooth_shading=True, - window_size=[1920, 1080], - savefig=filename, - ) - assert os.path.isfile(filename) - - -def test_cyclic_solve(mapdl_corba, cleared): - # build the cyclic model - mapdl_corba.prep7() - mapdl_corba.shpp("off") - mapdl_corba.cdread("db", examples.sector_archive_file) - mapdl_corba.prep7() - mapdl_corba.cyclic() - - # set material properties - mapdl_corba.mp("NUXY", 1, 0.31) - mapdl_corba.mp("DENS", 1, 4.1408e-04) - mapdl_corba.mp("EX", 1, 16900000) - mapdl_corba.emodif("ALL", "MAT", 1) - - # setup and solve - mapdl_corba.modal_analysis("LANB", 1, 1, 100000, elcalc=True) - mapdl_corba.finish() - - # expect 16 result sets (1 mode, 16 blades, 16 modes in mode family) - if mapdl_corba._local: - assert mapdl_corba.result.nsets == 16 - - -def test_partial_mesh_nnum(mapdl_corba, make_block): - allsel_nnum_old = mapdl_corba.mesh.nnum - mapdl_corba.nsel("S", "NODE", vmin=100, vmax=200) - allsel_nnum_now = mapdl_corba.mesh.nnum_all - assert np.allclose(allsel_nnum_old, allsel_nnum_now) - - mapdl_corba.allsel() - assert np.allclose(allsel_nnum_old, mapdl_corba.mesh.nnum) - - -def test_partial_mesh_nnum(mapdl_corba, make_block): - mapdl_corba.nsel("S", "NODE", vmin=1, vmax=10) - mapdl_corba.esel("S", "ELEM", vmin=10, vmax=20) - assert mapdl_corba.mesh._grid.n_cells == 11 - - -def test_cyclic_solve(mapdl_corba, cleared): - # build the cyclic model - mapdl_corba.prep7() - mapdl_corba.shpp("off") - mapdl_corba.cdread("db", examples.sector_archive_file) - mapdl_corba.prep7() - time.sleep(1.0) - mapdl_corba.cyclic() - - # set material properties - mapdl_corba.mp("NUXY", 1, 0.31) - mapdl_corba.mp("DENS", 1, 4.1408e-04) - mapdl_corba.mp("EX", 1, 16900000) - mapdl_corba.emodif("ALL", "MAT", 1) - - # setup and solve - mapdl_corba.modal_analysis("LANB", 1, 1, 100000, elcalc=True) - mapdl_corba.finish() - - # expect 16 result sets (1 mode, 16 blades, 16 modes in mode family) - assert mapdl_corba.result.nsets == 16 # multiple result files... - - -# Using ``np.ones(5)*2`` to test specifically the case for two columns #883 -@pytest.mark.parametrize("dim_rows", np.random.randint(2, 100, size=4, dtype=int)) -@pytest.mark.parametrize( - "dim_cols", - np.concatenate( - ( - np.ones(2, dtype=int) * 2, - np.random.randint(2, 100, size=2, dtype=int), - ) - ), -) -def test_load_table(mapdl_corba, dim_rows, dim_cols): - my_conv = np.random.rand(dim_rows, dim_cols) - my_conv[:, 0] = np.arange(dim_rows) - my_conv[0, :] = np.arange(dim_cols) - - mapdl_corba.load_table("my_conv", my_conv) - if ( - dim_cols == 2 - ): # because mapdl output arrays with shape (x,1) not (X,) See issue: #883 - assert np.allclose( - mapdl_corba.parameters["my_conv"], - my_conv[1:, 1].reshape((dim_rows - 1, 1)), - 1e-7, - ) - else: - assert np.allclose(mapdl_corba.parameters["my_conv"], my_conv[1:, 1:], 1e-7) - - -def test_mode_corba(mapdl_corba): - assert mapdl_corba.mode == "corba" - assert not mapdl_corba.is_grpc - assert mapdl_corba.is_corba - assert not mapdl_corba.is_console diff --git a/tests/test_grpc.py b/tests/test_grpc.py index 656f3cd1b0..9d78eacc50 100644 --- a/tests/test_grpc.py +++ b/tests/test_grpc.py @@ -420,7 +420,7 @@ def test__channel_str(mapdl): assert re.search("\d{4,6}", mapdl._channel_str) -def test_mode_corba(mapdl): +def test_mode(mapdl): assert mapdl.connection == "grpc" assert mapdl.is_grpc assert not mapdl.is_corba diff --git a/tests/test_launcher.py b/tests/test_launcher.py index 11c055ca60..303b19b081 100644 --- a/tests/test_launcher.py +++ b/tests/test_launcher.py @@ -2,7 +2,6 @@ import os import tempfile -import weakref import pytest @@ -21,13 +20,6 @@ from ansys.mapdl.core.licensing import LICENSES from conftest import QUICK_LAUNCH_SWITCHES, requires -try: - import ansys_corba # noqa: F401 - - HAS_CORBA = True -except: - HAS_CORBA = False - try: from ansys.tools.path import ( find_ansys, @@ -127,7 +119,7 @@ def test_invalid_mode(): def test_old_version(): exec_file = find_ansys("150")[0] with pytest.raises(ValueError): - pymapdl.launch_mapdl(exec_file, mode="corba", start_timeout=start_timeout) + pymapdl.launch_mapdl(exec_file, mode="console", start_timeout=start_timeout) @requires("ansys-tools-path") @@ -151,23 +143,6 @@ def test_launch_console(version): assert mapdl.version == int(version) / 10 -@requires("ansys-tools-path") -@requires("local") -@requires("corba") -@pytest.mark.parametrize("version", installed_mapdl_versions) -def test_launch_corba(version): - mapdl = pymapdl.launch_mapdl( - find_ansys(version)[0], mode="corba", start_timeout=start_timeout - ) - assert mapdl.version == int(version) / 10 - # mapdl.exit() # exit is already tested for in test_mapdl.py. - # Instead, test collection - - mapdl_ref = weakref.ref(mapdl) - del mapdl - assert mapdl_ref() is None - - @requires("local") def test_license_type_keyword(): checks = [] diff --git a/tests/test_mapdl.py b/tests/test_mapdl.py index e7b311b3a3..fafe1ff038 100644 --- a/tests/test_mapdl.py +++ b/tests/test_mapdl.py @@ -469,11 +469,11 @@ def test_apdl_logging_start(tmpdir): assert "K,4,0,1,0" in text -@requires("corba") -def test_corba_apdl_logging_start(tmpdir): +@requires("console") +def test_console_apdl_logging_start(tmpdir): filename = str(tmpdir.mkdir("tmpdir").join("tmp.inp")) - mapdl = pymapdl.launch_mapdl(mode="CORBA", log_apdl=filename) + mapdl = launch_mapdl(log_apdl=filename, mode="console") mapdl.prep7() mapdl.run("!comment test") diff --git a/tox.ini b/tox.ini index f510d23321..6d5b8ecd56 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,6 @@ isolated_build_env = build [testenv] description = Checks for project unit tests and coverage (if desired) basepython = - py38: python3.8 py39: python3.9 py310: python3.10 py311: python3.11