Skip to content
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
74 changes: 74 additions & 0 deletions .github/workflows/weekly-solvermode-test-run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Weekly solvermodel test run

on:
schedule: # UTC at 0400 on Monday
- cron: '0 4 * * MON'
workflow_dispatch:

env:
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
PYFLUENT_TIMEOUT_FORCE_EXIT: 30
PYFLUENT_LAUNCH_CONTAINER: 1
PYFLUENT_LOGGING: 'DEBUG'
PYFLUENT_WATCHDOG_DEBUG: 'OFF'
PYFLUENT_HIDE_LOG_SECRETS: 1
FLUENT_IMAGE_TAG: v24.1.0

jobs:
test:
name: Unit Testing
runs-on: [self-hosted, pyfluent]

steps:
- uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: Python-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements/requirements_*.txt') }}
restore-keys: |
Python-${{ runner.os }}-${{ matrix.python-version }}

- name: Add version information
run: make version-info

- name: Install pyfluent
run: make install

- name: Retrieve PyFluent version
run: |
echo "PYFLUENT_VERSION=$(python -c "from ansys.fluent.core import __version__; print(); print(__version__)" | tail -1)" >> $GITHUB_OUTPUT
echo "PYFLUENT version is: $(python -c "from ansys.fluent.core import __version__; print(); print(__version__)" | tail -1)"
id: version

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.GH_USERNAME }}
password: ${{ secrets.REPO_DOWNLOAD_PAT }}

- name: Pull 24.1 Fluent docker image
run: make docker-pull

- name: Run 24.1 API codegen
run: make api-codegen

- name: Print 24.1 Fluent version info
run: |
cat src/ansys/fluent/core/fluent_version_241.py
python -c "from ansys.fluent.core.solver.settings_241 import SHASH; print(f'SETTINGS_HASH = {SHASH}')"

- name: Install again after codegen
run: |
rm -rf dist
make install > /dev/null

- name: 24.1 Unit Testing
run: make unittest-solvermode-241
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ unittest-all-241:
@pip install -r requirements/requirements_tests.txt
@python -m pytest --nightly --fluent-version=24.1

unittest-solvermode-241:
@echo "Running all unittests"
@sudo rm -rf /home/ansys/.local/share/ansys_fluent_core/examples
@pip install -r requirements/requirements_tests.txt
@python -m pytest --fluent-version=24.1 --solvermode

unittest-all-241-no-codegen:
@echo "Running all unittests"
@sudo rm -rf /home/ansys/.local/share/ansys_fluent_core/examples
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ skip_glob = [
"src/ansys/fluent/core/solver/settings_222",
"src/ansys/fluent/core/solver/settings_231",
"src/ansys/fluent/core/solver/settings_232",
"src/ansys/fluent/core/solver/settings_241"
"src/ansys/fluent/core/solver/settings_241"
]
filter_files = "true"
known_first_party = ["ansys"]
Expand Down Expand Up @@ -78,7 +78,7 @@ exclude = [
"src/ansys/fluent/core/meshing/tui_241.py",
"src/ansys/fluent/core/solver/tui_241.py",
"src/ansys/fluent/core/solver/settings_241/",
"src/ansys/fluent/core/datamodel_241/"
"src/ansys/fluent/core/datamodel_241/"
]
pre-summary-space = true
wrap-descriptions = 88
Expand Down
8 changes: 8 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,21 @@ def pytest_addoption(parser):
parser.addoption(
"--nightly", action="store_true", default=False, help="run nightly tests"
)
parser.addoption(
"--solvermode", action="store_true", default=False, help="run solvermode tests"
)


def pytest_runtest_setup(item):
is_nightly = item.config.getoption("--nightly")
if not is_nightly and any(mark.name == "nightly" for mark in item.iter_markers()):
pytest.skip()

is_solvermode_option = item.config.getoption("--solvermode")
is_solvermode_path = "test_solvermode" in item.path.parts
if is_solvermode_option ^ is_solvermode_path:
pytest.skip()

version_specs = []
for mark in item.iter_markers(name="fluent_version"):
spec = mark.args[0]
Expand Down
5 changes: 1 addition & 4 deletions tests/test_flobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,10 +769,7 @@ def test_find_children_from_fluent_solver_session(load_static_mixer_case):
assert len(setup_children) >= 18514

viscous = load_mixer.models.viscous
assert set(find_children(viscous, "prod*")) >= {
"options/production_kato_launder",
"turbulence_expert/production_limiter",
}
assert len(find_children(viscous, "prod*")) > 0

assert any(
path
Expand Down
9 changes: 4 additions & 5 deletions tests/test_fluent_fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ def test_1364(new_solver_session):

solver.file.read_case(file_name=import_filename)

report_def = solver.solution.report_definitions
report_def.volume.create("xxx")
report_def = solver.solution.report_definitions.volume.create("xxx")

report_def["xxx"].set_state(
report_def.set_state(
{
"report_type": "volume-max",
"field": "temperature",
Expand All @@ -29,6 +28,6 @@ def test_1364(new_solver_session):
}
)

assert report_def.volume["xxx"].zone_names.allowed_values() == ["fluid"]
assert report_def.cell_zones.allowed_values() == ["fluid"]

assert report_def.volume["xxx"].expr_list.allowed_values() == None
assert report_def.expr_list.allowed_values() == None
2 changes: 0 additions & 2 deletions tests/test_solvermode/test_boundaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from util.solver import assign_settings_value_from_value_dict as assign_dict_val


@pytest.mark.nightly
@pytest.mark.fluent_version(">=24.1")
@pytest.mark.integration
@pytest.mark.setup
Expand Down Expand Up @@ -77,7 +76,6 @@ def test_boundaries_elbow(load_mixing_elbow_mesh):


# TODO: Skipped for the nightly test run to be successful. Later decide what to do with this test (discard?).
@pytest.mark.nightly
@pytest.mark.integration
@pytest.mark.setup
@pytest.mark.fluent_version("latest")
Expand Down
1 change: 0 additions & 1 deletion tests/test_solvermode/test_calculationactivities.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import pytest


@pytest.mark.nightly
@pytest.mark.integration
@pytest.mark.quick
@pytest.mark.fluent_version("latest")
Expand Down
1 change: 0 additions & 1 deletion tests/test_solvermode/test_controls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import pytest


@pytest.mark.nightly
@pytest.mark.quick
@pytest.mark.setup
@pytest.mark.fluent_version("latest")
Expand Down
2 changes: 0 additions & 2 deletions tests/test_solvermode/test_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


@pytest.mark.skip("Fluent side bug")
@pytest.mark.nightly
@pytest.mark.quick
@pytest.mark.setup
@pytest.mark.fluent_version("latest")
Expand Down Expand Up @@ -82,7 +81,6 @@ def test_solver_import_mixingelbow(load_mixing_elbow_mesh):
os.remove(file_path)


@pytest.mark.nightly
@pytest.mark.quick
@pytest.mark.setup
@pytest.mark.fluent_version("latest")
Expand Down
2 changes: 0 additions & 2 deletions tests/test_solvermode/test_initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from util.fixture_fluent import download_input_file


@pytest.mark.nightly
@pytest.mark.quick
@pytest.mark.setup
@pytest.mark.skip("Too sensitive to settings API; test doesn't initialize at all")
Expand Down Expand Up @@ -63,7 +62,6 @@ def test_initialize(launch_fluent_solver_3ddp_t2):
# solver.exit()


@pytest.mark.nightly
@pytest.mark.quick
@pytest.mark.setup
@pytest.mark.fluent_version(">=24.1")
Expand Down
1 change: 0 additions & 1 deletion tests/test_solvermode/test_materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from util.solver import copy_database_material


@pytest.mark.nightly
@pytest.mark.quick
@pytest.mark.setup
@pytest.mark.fluent_version("latest")
Expand Down
1 change: 0 additions & 1 deletion tests/test_solvermode/test_methods.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import pytest


@pytest.mark.nightly
@pytest.mark.quick
@pytest.mark.setup
@pytest.mark.fluent_version("latest")
Expand Down
2 changes: 0 additions & 2 deletions tests/test_solvermode/test_models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import pytest


@pytest.mark.nightly
@pytest.mark.integration
@pytest.mark.quick
@pytest.mark.setup
Expand All @@ -24,7 +23,6 @@ def test_solver_models(load_mixing_elbow_mesh):
assert models.multiphase.models() == "eulerian"


@pytest.mark.nightly
@pytest.mark.quick
@pytest.mark.setup
@pytest.mark.fluent_version("latest")
Expand Down
1 change: 0 additions & 1 deletion tests/test_solvermode/test_named_expressions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import pytest


@pytest.mark.nightly
@pytest.mark.quick
@pytest.mark.setup
@pytest.mark.fluent_version(">=24.1")
Expand Down
1 change: 0 additions & 1 deletion tests/test_solvermode/test_post_vector.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import pytest


@pytest.mark.nightly
@pytest.mark.setup
@pytest.mark.fluent_version("latest")
def test_post_elbow(load_mixing_elbow_case_dat):
Expand Down