Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing CWD and failing tests #860

Merged
merged 3 commits into from
Jan 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions ansys/mapdl/core/mapdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def __enter__(self):
self._parent()._store_commands = True

def __exit__(self, *args):
self._parent()._log.debug("Entering non-interactive mode")
self._parent()._log.debug("Exiting non-interactive mode")
self._parent()._flush_stored()

class _chain_commands:
Expand Down Expand Up @@ -2747,7 +2747,8 @@ def cwd(self, *args, **kwargs):
"""Wraps cwd"""
returns_ = super().cwd( *args, **kwargs)

if '*** WARNING ***' in self._response:
warn('\n' + self._response)
if returns_: # if successful, it should be none.
if '*** WARNING ***' in self._response:
warn('\n' + self._response)

return returns_
8 changes: 2 additions & 6 deletions tests/test_mapdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,6 @@ def test_cdread(mapdl, cleared):
assert random_letters in mapdl.parameters['PARMTEST']


# CDREAD tests are actually a good way to test 'input' command.
@skip_in_cloud
def test_cdread_different_location(mapdl, cleared, tmpdir):
random_letters = mapdl.directory.split('/')[0][-3:0]
Expand Down Expand Up @@ -948,25 +947,22 @@ def test_inval_commands_silent(mapdl, tmpdir, cleared):
@skip_in_cloud
def test_path_without_spaces(mapdl, path_tests):
resp = mapdl.cwd(path_tests.path_without_spaces)
assert 'WARNING' not in resp
assert resp is None


@skip_in_cloud
def test_path_with_spaces(mapdl, path_tests):
resp = mapdl.cwd(path_tests.path_with_spaces)
assert 'WARNING' not in resp
assert resp is None


@skip_in_cloud
def test_path_with_single_quote(mapdl, path_tests):
with pytest.raises(RuntimeError):
resp = mapdl.cwd(path_tests.path_with_single_quote)
assert 'WARNING' not in resp


@skip_in_cloud
def test_cwd_directory(mapdl, tmpdir):

mapdl.directory = str(tmpdir)
assert mapdl.directory == str(tmpdir).replace('\\', '/')

Expand Down