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

Fix geometry connection command tests on earlier MAPDL versions #2339

Merged
merged 5 commits into from
Sep 18, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ jobs:
build-test-ubuntu:
name: "Local: Build and unit testing on Ubuntu"
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main'
if: github.ref != 'refs/heads/main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
timeout-minutes: 55
container:
image: ghcr.io/ansys/mapdl:v22.2-ubuntu
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linkchecker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
linkchecker:
name: Check Links
runs-on: ubuntu-latest
timeout-minutes: 60
env:
PYMAPDL_PORT: 21000 # default won't work on GitHub runners
PYMAPDL_DB_PORT: 21001 # default won't work on GitHub runners
Expand Down Expand Up @@ -91,7 +92,6 @@ jobs:

- name: "Upload HTML Documentation"
uses: actions/upload-artifact@v3
if: always()
with:
name: documentation-html
path: doc/_build/html
Expand Down
7 changes: 5 additions & 2 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ def is_on_ci():

# Set if on ubuntu
def is_on_ubuntu():
if os.environ.get("ON_UBUNTU", "").lower() == "true":
return True
envvar = os.environ.get("ON_UBUNTU", None)

if envvar is not None:
return envvar.lower() == "true"

return _is_ubuntu()


Expand Down
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
ON_LOCAL = is_on_local()
ON_CI = is_on_ci()

ON_UBUNTU = is_on_ubuntu()
ON_UBUNTU = is_on_ubuntu() # Tells if MAPDL is running on Ubuntu system or not.
# Whether PyMAPDL is running on an ubuntu or different machine is irrelevant.
ON_WINDOWS = platform == "win32"
ON_LINUX = platform == "linux" or platform == "linux2"
ON_MACOS = platform == "darwin"
Expand Down
24 changes: 22 additions & 2 deletions tests/test_importing_geometries.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
MapdlInvalidRoutineError,
MapdlRuntimeError,
)
from conftest import ON_CI, ON_LOCAL
from conftest import ON_CI, ON_LOCAL, ON_UBUNTU

PATH = os.path.dirname(os.path.abspath(__file__))

Expand Down Expand Up @@ -90,6 +90,15 @@ def test_readin_sat(mapdl, cleared):
context = pytest.raises(
MapdlRuntimeError, match="Specified library does not exist."
)

elif ON_CI and mapdl.version <= 22.2 and not ON_UBUNTU:
context = pytest.raises(
MapdlRuntimeError, match="No shared command/library files were found"
)

elif ON_CI and mapdl.version == 22.2 and ON_UBUNTU and not ON_LOCAL:
context = pytest.raises(MapdlCommandIgnoredError, match="anf does not exist.")

elif ON_CI and ON_LOCAL:
context = pytest.raises(MapdlCommandIgnoredError, match="anf does not exist.")
elif ON_CI:
Expand All @@ -114,6 +123,11 @@ def test_readin_x_t(mapdl, cleared):
elif ON_CI and mapdl.version == 23.1:
context = pytest.raises(MapdlCommandIgnoredError, match="does not exist")

elif ON_CI and mapdl.version <= 22.2 and not ON_UBUNTU:
context = pytest.raises(
MapdlRuntimeError, match="No shared command/library files were found"
)

elif ON_CI and ON_LOCAL:
context = pytest.raises(AssertionError)

Expand All @@ -133,10 +147,16 @@ def test_readin_x_t(mapdl, cleared):


def test_readin_catiav5(mapdl, cleared):
if ON_CI:
if ON_CI and mapdl.version <= 22.2 and not ON_UBUNTU:
context = pytest.raises(
MapdlRuntimeError, match="No shared command/library files were found"
)

elif ON_CI:
context = pytest.raises(
MapdlInvalidRoutineError, match=" ~CAT5IN is not a recognized"
)

else:
context = NullContext()

Expand Down