From 2235a190a8a01b944981549a3cc2af6d3621aa60 Mon Sep 17 00:00:00 2001 From: Camille <78221213+clatapie@users.noreply.github.com> Date: Mon, 21 Oct 2024 12:24:39 +0200 Subject: [PATCH] review: applying @germa89's suggestions - 2 --- src/ansys/mapdl/core/mapdl_core.py | 2 +- src/ansys/mapdl/core/mapdl_grpc.py | 4 ++-- tests/test_examples.py | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ansys/mapdl/core/mapdl_core.py b/src/ansys/mapdl/core/mapdl_core.py index b9b3b9e817..45e93c237a 100644 --- a/src/ansys/mapdl/core/mapdl_core.py +++ b/src/ansys/mapdl/core/mapdl_core.py @@ -2313,7 +2313,7 @@ def __del__(self): if self._log is not None: self._log.error("exit: %s", str(e)) except ValueError: - logger.warning(f"Unable to exit the MAPDL session.") + pass def _cleanup_loggers(self): """Clean up all the loggers""" diff --git a/src/ansys/mapdl/core/mapdl_grpc.py b/src/ansys/mapdl/core/mapdl_grpc.py index 5e6c41a240..aa28dd49dc 100644 --- a/src/ansys/mapdl/core/mapdl_grpc.py +++ b/src/ansys/mapdl/core/mapdl_grpc.py @@ -890,8 +890,8 @@ def _launch(self, start_parm, timeout=10): except MapdlRuntimeError: warn("PyMAPDL is taking longer than expected to connect to the server.") - if not success: - raise MapdlConnectionError("Unable to reconnect to MAPDL") + if not success: + raise MapdlConnectionError("Unable to reconnect to MAPDL") # Update process self._mapdl_process = process diff --git a/tests/test_examples.py b/tests/test_examples.py index f9b4042da5..1ad131b04e 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -25,6 +25,7 @@ from subprocess import PIPE, STDOUT, Popen import pytest +from requests.exceptions import HTTPError from ansys.mapdl.core import EXAMPLES_PATH, examples from ansys.mapdl.core.examples.downloads import ( @@ -112,7 +113,7 @@ def test_download_example_data_true_download(): def test_failed_download(running_test): filename = "non_existing_file" - with pytest.raises(ValueError): + with pytest.raises(HTTPError): with running_test(active=False): # To force downloading the file _download_file(filename, directory=None)