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
10 changes: 10 additions & 0 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,16 @@ jobs:
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
IMAGE_NAME: "ghcr.io/ansys/acp${{ github.event.inputs.docker_image_suffix || ':latest' }}"

- name: "Unit testing (2024R2 server)"
if: matrix.python-version == env.MAIN_PYTHON_VERSION
working-directory: tests/unittests
run: |
docker pull $IMAGE_NAME
poetry run pytest -v --license-server=1055@$LICENSE_SERVER --no-server-log-files --docker-image=$IMAGE_NAME --cov=ansys.acp.core --cov-report=term --cov-report=xml --cov-report=html --cov-append
env:
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
IMAGE_NAME: "ghcr.io/ansys/acp:2024r2"

- name: "Upload coverage report (HTML)"
uses: actions/upload-artifact@v4
if: matrix.python-version == env.MAIN_PYTHON_VERSION
Expand Down
3 changes: 3 additions & 0 deletions src/ansys/acp/core/_tree_objects/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ def clone(self: Self, *, unlink: bool = False) -> Self:
new_object_info.properties.CopyFrom(self._pb_object.properties)
if unlink:
unlink_objects(new_object_info.properties)
# Since there may be links in the unknown fields, we need to
# discard them to avoid errors when storing the object.
new_object_info.properties.DiscardUnknownFields() # type: ignore
new_object_info.info.name = self._pb_object.info.name
return type(self)._from_object_info(object_info=new_object_info)

Expand Down
12 changes: 12 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

import docker
from hypothesis import settings
from packaging.version import parse as parse_version
import pytest

from ansys.acp.core import (
Expand Down Expand Up @@ -260,3 +261,14 @@ def inner(model, relative_file_path="square_and_solid.stp"):
)

return inner


@pytest.fixture
def xfail_before(acp_instance):
"""Mark a test as expected to fail before a certain server version."""

def inner(version: str):
if parse_version(acp_instance.server_version) < parse_version(version):
pytest.xfail(f"Expected to fail until server version {version!r}")

return inner
3 changes: 2 additions & 1 deletion tests/unittests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,12 @@ def test_regression_454(minimal_complete_model):
assert not hasattr(minimal_complete_model, "store")


def test_modeling_ply_export(acp_instance, minimal_complete_model):
def test_modeling_ply_export(acp_instance, minimal_complete_model, xfail_before):
"""
Test that the 'export_modeling_ply_geometries' method produces a file.
The contents of the file are not checked.
"""
xfail_before("25.1")
out_filename = "modeling_ply_export.step"

with tempfile.TemporaryDirectory() as tmp_dir:
Expand Down