Skip to content

Commit

Permalink
replacing negative conditions by positive ones
Browse files Browse the repository at this point in the history
  • Loading branch information
germa89 committed Oct 26, 2023
1 parent 51c122b commit a28898a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
17 changes: 17 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@
reason="""Requires DPF.""",
)

requires_linux = pytest.mark.skipif(not ON_LINUX, reason="This test requires Linux")
requires_windows = pytest.mark.skipif(
not ON_WINDOWS, reason="This test requires Windows"
)
requires_on_cicd = pytest.mark.skipif(
not ON_CI, reason="This test requires to be on CICD"
)


def has_dependency(requirement):
try:
Expand All @@ -96,15 +104,24 @@ def requires(requirement: str):
elif "local" == requirement:
return skip_if_not_local

elif "cicd" == requirement:
return skip_if_on_cicd

elif "nocicd" == requirement:
return skip_if_on_cicd

elif "xserver" == requirement:
return skip_no_xserver

elif "linux" == requirement:
return requires_linux

elif "nolinux" == requirement:
return skip_on_linux

elif "windows" == requirement:
return requires_windows

elif "nowindows" == requirement:
return skip_on_windows

Expand Down
10 changes: 5 additions & 5 deletions tests/test_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def fake_local_mapdl(mapdl):


@requires("local")
@requires("nolinux")
@requires("windows")
def test_validate_sw():
# ensure that windows adds msmpi
# fake windows path
Expand Down Expand Up @@ -104,7 +104,7 @@ def test_catch_version_from_path():

@requires("ansys-tools-path")
@requires("local")
@requires("nowindows")
@requires("linux")
def test_find_ansys_linux():
# assuming ansys is installed, should be able to find it on linux
# without env var
Expand Down Expand Up @@ -132,7 +132,7 @@ def test_old_version():

@requires("ansys-tools-path")
@requires("local")
@requires("nowindows")
@requires("linux")
@requires("console")
def test_failed_console():
exec_file = find_ansys(installed_mapdl_versions[0])[0]
Expand All @@ -143,7 +143,7 @@ def test_failed_console():
@requires("ansys-tools-path")
@requires("local")
@requires("console")
@requires("nowindows")
@requires("linux")
@pytest.mark.parametrize("version", installed_mapdl_versions)
def test_launch_console(version):
exec_file = find_ansys(version)[0]
Expand Down Expand Up @@ -439,7 +439,7 @@ def test_raise_exec_path_and_version_launcher():
)


@requires("nowindows")
@requires("linux")
@requires("local")
def test_is_ubuntu():
assert _is_ubuntu()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_mapdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,7 @@ def test_file_command_remote(mapdl, cube_solve, tmpdir):
assert "DATA FILE CHANGED TO FILE" in output


@requires("windows")
@requires("linux")
def test_lgwrite(mapdl, cleared, tmpdir):
filename = str(tmpdir.join("file.txt"))

Expand Down

0 comments on commit a28898a

Please sign in to comment.