Skip to content

Commit

Permalink
Fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
germa89 committed Mar 14, 2023
1 parent a255db9 commit e1bd688
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 2 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,8 @@ def test_cmd_class_dlist_vm(mapdl, cleared):
# Run only the first 100 lines of VM223
with open(verif_files.vmfiles["vm223"]) as fid:
cmds = fid.readlines()

mapdl.finish()
mapdl.input_strings("\n".join(cmds[:100]))

mapdl.allsel("all")
Expand Down
6 changes: 3 additions & 3 deletions tests/test_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from ansys.mapdl.core import examples
from ansys.mapdl.core.common_grpc import DEFAULT_CHUNKSIZE
from ansys.mapdl.core.errors import MapdlRuntimeError
from ansys.mapdl.core.errors import MapdlCommandIgnoredError, MapdlRuntimeError
from ansys.mapdl.core.launcher import check_valid_ansys, get_start_instance
from ansys.mapdl.core.misc import random_string

Expand Down Expand Up @@ -124,7 +124,7 @@ def test_clear_multiple(mapdl):


def test_invalid_get(mapdl):
with pytest.raises(MapdlRuntimeError):
with pytest.raises((MapdlRuntimeError, MapdlCommandIgnoredError)):
mapdl.get_value("ACTIVE", item1="SET", it1num="invalid")


Expand Down Expand Up @@ -241,7 +241,7 @@ def test_read_input_file(mapdl, file_name):


def test_no_get_value_non_interactive(mapdl):
with pytest.raises(RuntimeError, match="Cannot use gRPC enabled ``GET``"):
with pytest.raises((RuntimeError, MapdlCommandIgnoredError)):
with mapdl.non_interactive:
mapdl.get_value("ACTIVE", item1="CSYS")

Expand Down
10 changes: 6 additions & 4 deletions tests/test_inline_functions/test_query.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import pytest

from ansys.mapdl.core.errors import MapdlCommandIgnoredError, MapdlRuntimeError


class TestParseParameter:
@pytest.mark.parametrize(
Expand Down Expand Up @@ -69,10 +71,10 @@ def test_run_query_returned_type(self, line_geometry, command):
assert isinstance(v, type_)

def test_interactive_mode_error(self, mapdl, line_geometry):
q, kps, l0 = line_geometry
with mapdl.non_interactive:
with pytest.raises(RuntimeError):
v = q.kx(1)
q, _, _ = line_geometry
with pytest.raises((MapdlRuntimeError, MapdlCommandIgnoredError)):
with mapdl.non_interactive:
q.kx(1)

@pytest.mark.skip_grpc # only works in gRPC mode
def test_nopr_mode(self, mapdl, line_geometry):
Expand Down

0 comments on commit e1bd688

Please sign in to comment.