File tree Expand file tree Collapse file tree 4 files changed +22
-14
lines changed Expand file tree Collapse file tree 4 files changed +22
-14
lines changed Original file line number Diff line number Diff line change 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
5950 username : ${{ secrets.GH_USERNAME }}
6051 password : ${{ secrets.GH_TOKEN }}
6152 env :
53+ ANSYS_LOCAL : true
6254 ON_UBUNTU : true
6355
6456 steps :
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
Original file line number Diff line number Diff line change 2222"""Module for integration tests."""
2323
2424import json
25+ import os
2526from pathlib import Path
2627
2728import pytest
3435)
3536from 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
3944def 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
4752def 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
5459def test_save_mapdl_path ():
5560 """Test saving the MAPDL path to the configuration file."""
Original file line number Diff line number Diff line change 2121# SOFTWARE.
2222"""Module for testing metadata."""
2323
24+ import os
25+
2426from 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+ )
Original file line number Diff line number Diff 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
377376def 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 ()
You can’t perform that action at this time.
0 commit comments