Skip to content

Commit 6a55b87

Browse files
fix: Revert
1 parent 3e136d3 commit 6a55b87

File tree

4 files changed

+22
-14
lines changed

4 files changed

+22
-14
lines changed

.github/workflows/cicd.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,6 @@ jobs:
3838
operating-system: ${{ matrix.os }}
3939
python-version: ${{ matrix.python-version }}
4040
whitelist-license-check: "termcolor" # Has MIT license, but it's not recognized
41-
tests:
42-
name: Run tests
43-
runs-on: ubuntu-latest
44-
steps:
45-
- name: Run tests
46-
uses: ansys/actions/tests-pytest@v9
47-
with:
48-
library-name: ${{ env.PACKAGE_NAME }}
49-
python-version: ${{ env.MAIN_PYTHON_VERSION }}
5041

5142
build-tests:
5243
name: Build and Testing
@@ -59,6 +50,7 @@ jobs:
5950
username: ${{ secrets.GH_USERNAME }}
6051
password: ${{ secrets.GH_TOKEN }}
6152
env:
53+
ANSYS_LOCAL: true
6254
ON_UBUNTU: true
6355

6456
steps:
@@ -73,7 +65,7 @@ jobs:
7365

7466
- name: Unit testing
7567
run: |
76-
python -m pytest -m "not requires_mapdl" -vx --cov=${{ env.PACKAGE_NAMESPACE }} --cov-report=term --cov-report=xml:.cov/coverage.xml --cov-report=html:.cov/html
68+
python -m pytest -vx --cov=${{ env.PACKAGE_NAMESPACE }} --cov-report=term --cov-report=xml:.cov/coverage.xml --cov-report=html:.cov/html
7769
7870
- name: Upload coverage reports to Codecov
7971
uses: codecov/codecov-action@v5

tests/path/integration/test_integration.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"""Module for integration tests."""
2323

2424
import json
25+
import os
2526
from pathlib import Path
2627

2728
import pytest
@@ -34,22 +35,26 @@
3435
)
3536
from ansys.tools.path.path import CONFIG_FILE
3637

38+
skip_if_not_ansys_local = pytest.mark.skipif(
39+
os.environ.get("ANSYS_LOCAL", "").upper() != "TRUE", reason="Skipping on CI"
40+
)
41+
3742

38-
@pytest.mark.requires_mapdl
43+
@skip_if_not_ansys_local
3944
def test_find_mapdl():
4045
"""Test that the function finds the MAPDL executable and returns its path and version."""
4146
bin_file, ver = find_mapdl()
4247
assert Path(bin_file).is_file()
4348
assert ver != ""
4449

4550

46-
@pytest.mark.requires_mapdl
51+
@skip_if_not_ansys_local
4752
def test_get_available_ansys_installation():
4853
"""Test that the function returns a list of available Ansys installations."""
4954
assert get_available_ansys_installations()
5055

5156

52-
@pytest.mark.requires_mapdl
57+
@skip_if_not_ansys_local
5358
@pytest.mark.linux
5459
def test_save_mapdl_path():
5560
"""Test saving the MAPDL path to the configuration file."""

tests/path/unit/test_metadata.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
# SOFTWARE.
2222
"""Module for testing metadata."""
2323

24+
import os
25+
2426
from ansys.tools import __version__
2527

2628

@@ -33,3 +35,13 @@ def test_pkg_version():
3335
read_version = importlib_metadata.version("ansys-tools-common")
3436

3537
assert __version__ == read_version
38+
39+
40+
def test_cicd_envvar():
41+
"""Test that the environment variable `ANSYS_LOCAL` exists and is set to True or False."""
42+
if not os.environ.get("ANSYS_LOCAL", ""):
43+
# env var does not exists
44+
raise RuntimeError(
45+
"The env var 'ANSYS_LOCAL' does not exists. That env var is needed to tell Pytest which\n"
46+
"tests should be run depending on if MAPDL is installed ('ANSYS_LOCAL'=True) or not."
47+
)

tests/path/unit/test_path.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ def test_find_mechanical_without_student(mock_filesystem_without_student_version
373373

374374

375375
@pytest.mark.win32
376-
@pytest.mark.requires_mapdl
377376
def test_get_available_ansys_installation_windows(mock_filesystem, mock_awp_environment_variable):
378377
"""Test get available Ansys installations on Windows."""
379378
available_ansys_installations = get_available_ansys_installations()

0 commit comments

Comments
 (0)