diff --git a/.github/workflows/nightly_docker_test.yml b/.github/workflows/nightly_docker_test.yml index af3131626c..6230cbaf5f 100644 --- a/.github/workflows/nightly_docker_test.yml +++ b/.github/workflows/nightly_docker_test.yml @@ -200,10 +200,7 @@ jobs: name: Windows Core Service needs: manifests if: needs.manifests.outputs.skip_core_windows == 0 - # runs-on: [self-hosted, Windows, pygeometry] - runs-on: # TODO: Waiting for ansys-network runner to be updated - group: pyansys-self-hosted - labels: [self-hosted, Windows, pygeometry] + runs-on: [self-hosted, Windows, pygeometry] env: PYVISTA_OFF_SCREEN: true steps: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 67b63132c0..2856dc3cef 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,13 +7,13 @@ exclude: "tests/integration/files" repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.1 + rev: v0.9.3 hooks: - id: ruff - id: ruff-format - repo: https://github.com/codespell-project/codespell - rev: v2.3.0 + rev: v2.4.0 hooks: - id: codespell args: ["--ignore-words", "doc/styles/config/vocabularies/ANSYS/accept.txt", "-w"] @@ -27,7 +27,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/ansys/pre-commit-hooks - rev: v0.4.4 + rev: v0.5.1 hooks: - id: add-license-headers args: diff --git a/doc/changelog.d/1659.maintenance.md b/doc/changelog.d/1659.maintenance.md new file mode 100644 index 0000000000..13faffdbf5 --- /dev/null +++ b/doc/changelog.d/1659.maintenance.md @@ -0,0 +1 @@ +reverting semver package whitelist since problematic version is yanked \ No newline at end of file diff --git a/doc/changelog.d/1662.dependencies.md b/doc/changelog.d/1662.dependencies.md new file mode 100644 index 0000000000..a20d9c8832 --- /dev/null +++ b/doc/changelog.d/1662.dependencies.md @@ -0,0 +1 @@ +bump numpy from 2.2.1 to 2.2.2 \ No newline at end of file diff --git a/doc/changelog.d/1663.dependencies.md b/doc/changelog.d/1663.dependencies.md new file mode 100644 index 0000000000..2a8a8ee966 --- /dev/null +++ b/doc/changelog.d/1663.dependencies.md @@ -0,0 +1 @@ +bump ansys-api-geometry from 0.4.30 to 0.4.31 \ No newline at end of file diff --git a/doc/changelog.d/1667.maintenance.md b/doc/changelog.d/1667.maintenance.md new file mode 100644 index 0000000000..c655a0905a --- /dev/null +++ b/doc/changelog.d/1667.maintenance.md @@ -0,0 +1 @@ +pre-commit automatic update \ No newline at end of file diff --git a/doc/changelog.d/1681.dependencies.md b/doc/changelog.d/1681.dependencies.md new file mode 100644 index 0000000000..08d164f517 --- /dev/null +++ b/doc/changelog.d/1681.dependencies.md @@ -0,0 +1 @@ +bump ansys-api-geometry from 0.4.31 to 0.4.32 \ No newline at end of file diff --git a/doc/changelog.d/1682.dependencies.md b/doc/changelog.d/1682.dependencies.md new file mode 100644 index 0000000000..b14ee7f0aa --- /dev/null +++ b/doc/changelog.d/1682.dependencies.md @@ -0,0 +1 @@ +bump panel from 1.5.5 to 1.6.0 \ No newline at end of file diff --git a/doc/changelog.d/1687.dependencies.md b/doc/changelog.d/1687.dependencies.md new file mode 100644 index 0000000000..fd0bb96377 --- /dev/null +++ b/doc/changelog.d/1687.dependencies.md @@ -0,0 +1 @@ +bump semver from 3.0.2 to 3.0.4 \ No newline at end of file diff --git a/doc/changelog.d/1691.fixed.md b/doc/changelog.d/1691.fixed.md new file mode 100644 index 0000000000..35561ba104 --- /dev/null +++ b/doc/changelog.d/1691.fixed.md @@ -0,0 +1 @@ +disable unimplemented tests \ No newline at end of file diff --git a/doc/changelog.d/1692.added.md b/doc/changelog.d/1692.added.md new file mode 100644 index 0000000000..27f9b9b33d --- /dev/null +++ b/doc/changelog.d/1692.added.md @@ -0,0 +1 @@ +is_core_service BackendType static method \ No newline at end of file diff --git a/doc/changelog.d/1693.maintenance.md b/doc/changelog.d/1693.maintenance.md new file mode 100644 index 0000000000..1de88e4184 --- /dev/null +++ b/doc/changelog.d/1693.maintenance.md @@ -0,0 +1 @@ +use dedicate pygeometry-ci-2 runner \ No newline at end of file diff --git a/doc/changelog.d/1695.dependencies.md b/doc/changelog.d/1695.dependencies.md new file mode 100644 index 0000000000..1c4695c819 --- /dev/null +++ b/doc/changelog.d/1695.dependencies.md @@ -0,0 +1 @@ +bump ansys-api-geometry from 0.4.32 to 0.4.33 \ No newline at end of file diff --git a/doc/changelog.d/1696.maintenance.md b/doc/changelog.d/1696.maintenance.md new file mode 100644 index 0000000000..c655a0905a --- /dev/null +++ b/doc/changelog.d/1696.maintenance.md @@ -0,0 +1 @@ +pre-commit automatic update \ No newline at end of file diff --git a/doc/source/conf.py b/doc/source/conf.py index 39e50c82e0..50177ff33b 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -57,10 +57,11 @@ def get_wheelhouse_assets_dictionary(): time.sleep(2) if content is None: - raise requests.exceptions.RequestException("Failed to retrieve the latest release.") - - # Just point to the latest version - assets_context_version = json.loads(content)["name"] + print("Adapting URL to point to the latest version... (hack)") + assets_context_version = "dev" + else: + # Just point to the latest version + assets_context_version = json.loads(content)["name"] else: assets_context_version = f"v{__version__}" @@ -68,12 +69,18 @@ def get_wheelhouse_assets_dictionary(): for assets_os, assets_runner in zip(assets_context_os, assets_context_runners): download_links = [] for assets_py_ver in assets_context_python_versions: + if assets_context_version == "dev": + prefix_url = "https://github.com/ansys/pyansys-geometry/releases/latest/download" + else: + prefix_url = ( + f"https://github.com/ansys/pyansys-geometry/releases/download/{assets_context_version}", + ) temp_dict = { "os": assets_os, "runner": assets_runner, "python_versions": assets_py_ver, "latest_released_version": assets_context_version, - "prefix_url": f"https://github.com/ansys/pyansys-geometry/releases/download/{assets_context_version}", # noqa: E501 + "prefix_url": prefix_url, } download_links.append(temp_dict) diff --git a/pyproject.toml b/pyproject.toml index 098b6919c9..d47cec3f73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ classifiers = [ ] dependencies = [ - "ansys-api-geometry==0.4.32", + "ansys-api-geometry==0.4.33", "ansys-tools-path>=0.3,<1", "ansys-tools-visualization-interface>=0.2.6,<1", "attrs!=24.3.0", @@ -58,7 +58,7 @@ tests = [ "geomdl==5.3.1", "grpcio==1.67.1", "grpcio-health-checking==1.67.1", - "numpy==2.2.1", + "numpy==2.2.2", "Pint==0.24.4", "protobuf==5.29.3", "pytest==8.3.4", @@ -68,7 +68,7 @@ tests = [ "pyvista[jupyter]==0.44.2", "requests==2.32.3", "scipy==1.15.1", - "semver==3.0.2", + "semver==3.0.4", "six==1.17.0", "vtk==9.3.1", ] @@ -95,14 +95,14 @@ doc = [ "nbsphinx==0.9.6", "notebook==7.3.2", "numpydoc==1.8.0", - "numpy==2.2.1", - "panel==1.5.5", + "numpy==2.2.2", + "panel==1.6.0", "Pint==0.24.4", "protobuf==5.29.3", "pyvista[jupyter]==0.44.2", "requests==2.32.3", "scipy==1.15.1", - "semver==3.0.2", + "semver==3.0.4", "six==1.17.0", "sphinx==8.1.3", "sphinx-autodoc-typehints==3.0.1", diff --git a/src/ansys/geometry/core/connection/backend.py b/src/ansys/geometry/core/connection/backend.py index 932a94cb7b..9ce27a94a1 100644 --- a/src/ansys/geometry/core/connection/backend.py +++ b/src/ansys/geometry/core/connection/backend.py @@ -33,6 +33,29 @@ class BackendType(Enum): SPACECLAIM = 1 WINDOWS_SERVICE = 2 LINUX_SERVICE = 3 + CORE_WINDOWS = 4 + CORE_LINUX = 5 + DISCOVERY_HEADLESS = 6 + + @staticmethod + def is_core_service(backend_type: "BackendType") -> bool: + """Determine whether the backend is CoreService based or not. + + Parameters + ---------- + backend_type : BackendType + The backend type to check whether or not it's a CoreService type. + + Returns + ------- + bool + True if the backend is CoreService based, False otherwise. + """ + return backend_type in ( + BackendType.LINUX_SERVICE, + BackendType.CORE_WINDOWS, + BackendType.CORE_LINUX, + ) class ApiVersions(Enum): diff --git a/src/ansys/geometry/core/connection/client.py b/src/ansys/geometry/core/connection/client.py index 96341c420c..fe7a7484e8 100644 --- a/src/ansys/geometry/core/connection/client.py +++ b/src/ansys/geometry/core/connection/client.py @@ -215,11 +215,26 @@ def __init__( backend_type = BackendType.WINDOWS_SERVICE elif grpc_backend_type == GRPCBackendType.LINUX_DMS: backend_type = BackendType.LINUX_SERVICE + elif grpc_backend_type == GRPCBackendType.CORE_SERVICE_LINUX: + backend_type = BackendType.CORE_LINUX + elif grpc_backend_type == GRPCBackendType.CORE_SERVICE_WINDOWS: + backend_type = BackendType.CORE_WINDOWS + elif grpc_backend_type == GRPCBackendType.DISCOVERY_HEADLESS: + backend_type = BackendType.DISCOVERY_HEADLESS # Store the backend type self._backend_type = backend_type self._multiple_designs_allowed = ( - False if backend_type in (BackendType.DISCOVERY, BackendType.LINUX_SERVICE) else True + False + if backend_type + in ( + BackendType.DISCOVERY, + BackendType.LINUX_SERVICE, + BackendType.CORE_LINUX, + BackendType.CORE_WINDOWS, + BackendType.DISCOVERY_HEADLESS, + ) + else True ) # retrieve the backend version diff --git a/src/ansys/geometry/core/connection/product_instance.py b/src/ansys/geometry/core/connection/product_instance.py index a569ba38e5..1bf5481c16 100644 --- a/src/ansys/geometry/core/connection/product_instance.py +++ b/src/ansys/geometry/core/connection/product_instance.py @@ -263,7 +263,10 @@ def prepare_and_start_backend( """ from ansys.geometry.core.modeler import Modeler - if os.name != "nt" and backend_type != BackendType.LINUX_SERVICE: # pragma: no cover + if os.name != "nt" and backend_type not in ( + BackendType.LINUX_SERVICE, + BackendType.CORE_LINUX, + ): # pragma: no cover raise RuntimeError( "Method 'prepare_and_start_backend' is only available on Windows." "A Linux version is only available for the Core Geometry Service." @@ -362,7 +365,7 @@ def prepare_and_start_backend( ) ) # This should be modified to Windows Core Service in the future - elif backend_type == BackendType.LINUX_SERVICE: + elif BackendType.is_core_service(backend_type): # Define several Ansys Geometry Core Service folders needed root_service_folder = Path(installations[product_version], CORE_GEOMETRY_SERVICE_FOLDER) native_folder = root_service_folder / "Native" diff --git a/src/ansys/geometry/core/modeler.py b/src/ansys/geometry/core/modeler.py index 948d136ebd..288f4abf97 100644 --- a/src/ansys/geometry/core/modeler.py +++ b/src/ansys/geometry/core/modeler.py @@ -126,9 +126,9 @@ def __init__( # Initialize the RepairTools - Not available on Linux # TODO: delete "if" when Linux service is able to use repair tools # https://github.com/ansys/pyansys-geometry/issues/1319 - if self.client.backend_type == BackendType.LINUX_SERVICE: + if BackendType.is_core_service(self.client.backend_type): self._measurement_tools = None - LOG.warning("Linux backend does not support measurement tools.") + LOG.warning("CoreService backend does not support measurement tools.") else: self._measurement_tools = MeasurementTools(self._grpc_client) diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 14fb644633..07ba60e67e 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -49,11 +49,11 @@ FILES_DIR = Path(Path(__file__).parent, "files") -def skip_if_linux(modeler: Modeler, test_name: str, element_not_available: str): - """Skip test if running on Linux.""" - if modeler.client.backend_type == BackendType.LINUX_SERVICE: +def skip_if_core_service(modeler: Modeler, test_name: str, element_not_available: str): + """Skip test if running on CoreService.""" + if BackendType.is_core_service(modeler.client.backend_type): pytest.skip( - reason=f"Skipping '{test_name}'. '{element_not_available}' not on Linux service." + reason=f"Skipping '{test_name}'. '{element_not_available}' not on CoreService." ) # skip! diff --git a/tests/integration/test_design.py b/tests/integration/test_design.py index b71503bada..dfb01b1007 100644 --- a/tests/integration/test_design.py +++ b/tests/integration/test_design.py @@ -72,7 +72,7 @@ from ansys.geometry.core.sketch import Sketch from ansys.tools.visualization_interface.utils.color import Color -from .conftest import FILES_DIR, skip_if_linux +from .conftest import FILES_DIR, skip_if_core_service def test_design_extrusion_and_material_assignment(modeler: Modeler): @@ -962,7 +962,7 @@ def test_download_file(modeler: Modeler, tmp_path_factory: pytest.TempPathFactor assert file.exists() # Check that we can also save it (even if it is not accessible on the server) - if modeler.client.backend_type == BackendType.LINUX_SERVICE: + if modeler.client.backend_type in (BackendType.LINUX_SERVICE, BackendType.CORE_LINUX): file_save = "/tmp/cylinder-temp.scdocx" else: file_save = tmp_path_factory.mktemp("scdoc_files_save") / "cylinder.scdocx" @@ -970,7 +970,7 @@ def test_download_file(modeler: Modeler, tmp_path_factory: pytest.TempPathFactor design.save(file_location=file_save) # Check for other exports - Windows backend... - if modeler.client.backend_type != BackendType.LINUX_SERVICE: + if not BackendType.is_core_service(modeler.client.backend_type): binary_parasolid_file = tmp_path_factory.mktemp("scdoc_files_download") / "cylinder.x_b" text_parasolid_file = tmp_path_factory.mktemp("scdoc_files_download") / "cylinder.x_t" @@ -983,6 +983,11 @@ def test_download_file(modeler: Modeler, tmp_path_factory: pytest.TempPathFactor design.download(iges_file, format=DesignFileFormat.IGES) assert iges_file.exists() + # FMD + fmd_file = tmp_path_factory.mktemp("scdoc_files_download") / "cylinder.fmd" + design.download(fmd_file, format=DesignFileFormat.FMD) + assert fmd_file.exists() + # Linux backend... else: binary_parasolid_file = tmp_path_factory.mktemp("scdoc_files_download") / "cylinder.xmt_bin" @@ -991,17 +996,12 @@ def test_download_file(modeler: Modeler, tmp_path_factory: pytest.TempPathFactor # PMDB pmdb_file = tmp_path_factory.mktemp("scdoc_files_download") / "cylinder.pmdb" - # FMD - fmd_file = tmp_path_factory.mktemp("scdoc_files_download") / "cylinder.fmd" - design.download(binary_parasolid_file, format=DesignFileFormat.PARASOLID_BIN) design.download(text_parasolid_file, format=DesignFileFormat.PARASOLID_TEXT) - design.download(fmd_file, format=DesignFileFormat.FMD) design.download(pmdb_file, format=DesignFileFormat.PMDB) assert binary_parasolid_file.exists() assert text_parasolid_file.exists() - assert fmd_file.exists() assert pmdb_file.exists() @@ -1162,8 +1162,8 @@ def test_copy_body(modeler: Modeler): def test_beams(modeler: Modeler): """Test beam creation.""" - # Skip on Linux - skip_if_linux(modeler, test_beams.__name__, "create_beam") + # Skip on CoreService + skip_if_core_service(modeler, test_beams.__name__, "create_beam") # Create your design on the server side design = modeler.create_design("BeamCreation") @@ -1465,8 +1465,8 @@ def test_named_selections_beams(modeler: Modeler): """Test for verifying the correct creation of ``NamedSelection`` with beams. """ - # Skip on Linux - skip_if_linux(modeler, test_named_selections_beams.__name__, "create_beam") + # Skip on CoreService + skip_if_core_service(modeler, test_named_selections_beams.__name__, "create_beam") # Create your design on the server side design = modeler.create_design("NamedSelectionBeams_Test") @@ -2053,7 +2053,8 @@ def test_get_collision(modeler: Modeler): def test_set_body_name(modeler: Modeler): """Test the setting the name of a body.""" - skip_if_linux(modeler, test_set_body_name.__name__, "set_name") # Skip test on Linux + # Skip test on CoreService + skip_if_core_service(modeler, test_set_body_name.__name__, "set_name") design = modeler.create_design("simple_cube") unit = DEFAULT_UNITS.LENGTH @@ -2074,7 +2075,8 @@ def test_set_body_name(modeler: Modeler): def test_set_fill_style(modeler: Modeler): """Test the setting the fill style of a body.""" - skip_if_linux(modeler, test_set_fill_style.__name__, "set_fill_style") # Skip test on Linux + # Skip test on CoreService + skip_if_core_service(modeler, test_set_fill_style.__name__, "set_fill_style") design = modeler.create_design("RVE") unit = DEFAULT_UNITS.LENGTH @@ -2270,7 +2272,9 @@ def test_body_mapping(modeler: Modeler): def test_sphere_creation(modeler: Modeler): """Test the creation of a sphere body with a given radius.""" - skip_if_linux(modeler, test_sphere_creation.__name__, "create_sphere") + # Skip test on CoreService + skip_if_core_service(modeler, test_sphere_creation.__name__, "create_sphere") + design = modeler.create_design("Spheretest") center_point = Point3D([10, 10, 10], UNITS.m) radius = Distance(1, UNITS.m) @@ -2282,7 +2286,9 @@ def test_sphere_creation(modeler: Modeler): def test_body_mirror(modeler: Modeler): """Test the mirroring of a body.""" - skip_if_linux(modeler, test_body_mirror.__name__, "mirror") + # Skip test on CoreService + skip_if_core_service(modeler, test_body_mirror.__name__, "mirror") + design = modeler.create_design("Design1") # Create shape with no lines of symmetry in any axis @@ -2488,7 +2494,8 @@ def test_create_body_from_loft_profile(modeler: Modeler): """Test the ``create_body_from_loft_profile()`` method to create a vase shape. """ - skip_if_linux( + # Skip test on CoreService + skip_if_core_service( modeler, test_create_body_from_loft_profile.__name__, "'create_body_from_loft_profile'" ) design_sketch = modeler.create_design("loftprofile") @@ -2604,8 +2611,8 @@ def test_revolve_sketch_fail_invalid_path(modeler: Modeler): def test_component_tree_print(modeler: Modeler): """Test for verifying the tree print for ``Component`` objects.""" - # Skip on Linux - skip_if_linux(modeler, test_component_tree_print.__name__, "create_beam") + # Skip on CoreService + skip_if_core_service(modeler, test_component_tree_print.__name__, "create_beam") def check_list_equality(lines, expected_lines): # By doing "a in b" rather than "a == b", we can check for substrings diff --git a/tests/integration/test_design_export.py b/tests/integration/test_design_export.py index 034f7fca16..c0b70e26db 100644 --- a/tests/integration/test_design_export.py +++ b/tests/integration/test_design_export.py @@ -30,6 +30,8 @@ from ansys.geometry.core.math import Plane, Point2D, Point3D, UnitVector3D, Vector3D from ansys.geometry.core.sketch import Sketch +from .conftest import skip_if_core_service + def _create_demo_design(modeler: Modeler) -> Design: """Create a demo design for the tests.""" @@ -138,7 +140,7 @@ def test_export_to_parasolid_text(modeler: Modeler, tmp_path_factory: pytest.Tem # Define the location and expected file location location = tmp_path_factory.mktemp("test_export_to_parasolid_text") - if modeler.client.backend_type == BackendType.LINUX_SERVICE: + if BackendType.is_core_service(modeler.client.backend_type): file_location = location / f"{design.name}.x_t" else: file_location = location / f"{design.name}.xmt_txt" @@ -161,7 +163,7 @@ def test_export_to_parasolid_binary(modeler: Modeler, tmp_path_factory: pytest.T # Define the location and expected file location location = tmp_path_factory.mktemp("test_export_to_parasolid_binary") - if modeler.client.backend_type == BackendType.LINUX_SERVICE: + if BackendType.is_core_service(modeler.client.backend_type): file_location = location / f"{design.name}.x_b" else: file_location = location / f"{design.name}.xmt_bin" @@ -178,6 +180,7 @@ def test_export_to_parasolid_binary(modeler: Modeler, tmp_path_factory: pytest.T def test_export_to_step(modeler: Modeler, tmp_path_factory: pytest.TempPathFactory): """Test exporting a design to STEP format.""" + skip_if_core_service(modeler, test_export_to_step.__name__, "step_export") # Create a demo design design = _create_demo_design(modeler) @@ -191,7 +194,7 @@ def test_export_to_step(modeler: Modeler, tmp_path_factory: pytest.TempPathFacto # Check the exported file assert file_location.exists() - if modeler.client.backend_type != BackendType.LINUX_SERVICE: + if not BackendType.is_core_service(modeler.client.backend_type): # Import the STEP file design_read = modeler.open_file(file_location) @@ -201,6 +204,7 @@ def test_export_to_step(modeler: Modeler, tmp_path_factory: pytest.TempPathFacto def test_export_to_iges(modeler: Modeler, tmp_path_factory: pytest.TempPathFactory): """Test exporting a design to IGES format.""" + skip_if_core_service(modeler, test_export_to_iges.__name__, "iges_export") # Create a demo design design = _create_demo_design(modeler) @@ -220,6 +224,7 @@ def test_export_to_iges(modeler: Modeler, tmp_path_factory: pytest.TempPathFacto def test_export_to_fmd(modeler: Modeler, tmp_path_factory: pytest.TempPathFactory): """Test exporting a design to FMD format.""" + skip_if_core_service(modeler, test_export_to_fmd.__name__, "fmd_export") # Create a demo design design = _create_demo_design(modeler) diff --git a/tests/integration/test_design_import.py b/tests/integration/test_design_import.py index 822fa7a047..23590c7767 100644 --- a/tests/integration/test_design_import.py +++ b/tests/integration/test_design_import.py @@ -36,7 +36,7 @@ from ansys.geometry.core.sketch import Sketch from ansys.geometry.core.tools.unsupported import PersistentIdType -from .conftest import FILES_DIR, IMPORT_FILES_DIR, skip_if_linux +from .conftest import FILES_DIR, IMPORT_FILES_DIR, skip_if_core_service def _checker_method(comp: Component, comp_ref: Component, precise_check: bool = True) -> None: @@ -213,7 +213,7 @@ def test_open_file(modeler: Modeler, tmp_path_factory: pytest.TempPathFactory): _checker_method(design, design2, True) # Test HOOPS formats (Windows only) - if modeler.client.backend_type != BackendType.LINUX_SERVICE: + if not BackendType.is_core_service(modeler.client.backend_type): # IGES # # TODO: Something has gone wrong with IGES @@ -260,8 +260,8 @@ def test_open_file(modeler: Modeler, tmp_path_factory: pytest.TempPathFactory): def test_design_insert(modeler: Modeler): """Test inserting a file into the design.""" - # Skip for Linux service - skip_if_linux(modeler, test_design_insert.__name__, "insert_file") + # Skip for CoreService + skip_if_core_service(modeler, test_design_insert.__name__, "insert_file") # Create a design and sketch a circle design = modeler.create_design("Insert") @@ -283,8 +283,8 @@ def test_design_insert_with_import(modeler: Modeler): """Test inserting a file into the design through the external format import process. """ - # Skip for Linux service - skip_if_linux(modeler, test_design_insert_with_import.__name__, "insert_file") + # Skip for CoreService + skip_if_core_service(modeler, test_design_insert_with_import.__name__, "insert_file") # Create a design and sketch a circle design = modeler.create_design("Insert") diff --git a/tests/integration/test_issues.py b/tests/integration/test_issues.py index 4988dba12e..f1a3b4ce3e 100644 --- a/tests/integration/test_issues.py +++ b/tests/integration/test_issues.py @@ -37,7 +37,7 @@ from ansys.geometry.core.modeler import Modeler from ansys.geometry.core.sketch import Sketch -from .conftest import FILES_DIR, skip_if_linux +from .conftest import FILES_DIR, skip_if_core_service def test_issue_834_design_import_with_surfaces(modeler: Modeler): @@ -48,7 +48,7 @@ def test_issue_834_design_import_with_surfaces(modeler: Modeler): """ # TODO: to be reactivated # https://github.com/ansys/pyansys-geometry/issues/799 - skip_if_linux(modeler, test_issue_834_design_import_with_surfaces.__name__, "open_file") + skip_if_core_service(modeler, test_issue_834_design_import_with_surfaces.__name__, "open_file") # Open the design design = modeler.open_file(Path(FILES_DIR, "DuplicateFacesDesignBefore.scdocx")) @@ -86,8 +86,8 @@ def test_issue_1184_sphere_creation_crashes(modeler: Modeler): For more info see https://github.com/ansys/pyansys-geometry/issues/1184 """ - # Skip this test on Linux since it is not implemented yet - skip_if_linux(modeler, test_issue_1184_sphere_creation_crashes.__name__, "create_sphere") + # Skip this test on CoreService since it is not implemented yet + skip_if_core_service(modeler, test_issue_1184_sphere_creation_crashes.__name__, "create_sphere") design = modeler.create_design("SphereCreationIssue") diff --git a/tests/integration/test_measurement_tools.py b/tests/integration/test_measurement_tools.py index 73f9e3e877..ec193d3ff1 100644 --- a/tests/integration/test_measurement_tools.py +++ b/tests/integration/test_measurement_tools.py @@ -25,7 +25,7 @@ from ansys.geometry.core.modeler import Modeler from ansys.geometry.core.tools.measurement_tools import Gap -from .conftest import FILES_DIR, skip_if_linux +from .conftest import FILES_DIR, skip_if_core_service def test_distance_property(modeler: Modeler): @@ -36,9 +36,9 @@ def test_distance_property(modeler: Modeler): def test_min_distance_between_objects(modeler: Modeler): """Test if split edge problem areas are detectable.""" - skip_if_linux( + skip_if_core_service( modeler, test_min_distance_between_objects.__name__, "measurement_tools" - ) # Skip test on Linux + ) # Skip test on CoreService design = modeler.open_file(FILES_DIR / "MixingTank.scdocx") gap = modeler.measurement_tools.min_distance_between_objects(design.bodies[2], design.bodies[1]) assert abs(gap.distance._value - 0.0892) <= 0.01 diff --git a/tests/integration/test_prepare_tools.py b/tests/integration/test_prepare_tools.py index f53cedd1e6..1aa4622542 100644 --- a/tests/integration/test_prepare_tools.py +++ b/tests/integration/test_prepare_tools.py @@ -23,7 +23,7 @@ from ansys.geometry.core.modeler import Modeler -from .conftest import FILES_DIR, skip_if_linux +from .conftest import FILES_DIR, skip_if_core_service def test_volume_extract_from_faces(modeler: Modeler): @@ -53,7 +53,8 @@ def test_volume_extract_from_edge_loops(modeler: Modeler): def test_share_topology(modeler: Modeler): """Test share topology operation is between two bodies.""" - skip_if_linux(modeler, test_share_topology.__name__, "prepare_tools") # Skip test on Linux + # Skip test on CoreService + skip_if_core_service(modeler, test_share_topology.__name__, "prepare_tools") design = modeler.open_file(FILES_DIR / "MixingTank.scdocx") assert modeler.prepare_tools.share_topology(design.bodies) diff --git a/tests/integration/test_repair_tools.py b/tests/integration/test_repair_tools.py index 82fcbe2b20..a61e3653c5 100644 --- a/tests/integration/test_repair_tools.py +++ b/tests/integration/test_repair_tools.py @@ -23,7 +23,7 @@ from ansys.geometry.core.modeler import Modeler -from .conftest import FILES_DIR, skip_if_linux +from .conftest import FILES_DIR, skip_if_core_service def test_find_split_edges(modeler: Modeler): @@ -183,7 +183,8 @@ def test_fix_duplicate_face(modeler: Modeler): def test_find_small_faces(modeler: Modeler): """Test to read geometry and find it's small face problem areas.""" - skip_if_linux(modeler, test_find_small_faces.__name__, "repair_tools") # Skip test on Linux + # Skip test on CoreService + skip_if_core_service(modeler, test_find_small_faces.__name__, "repair_tools") design = modeler.open_file(FILES_DIR / "SmallFacesBefore.scdocx") problem_areas = modeler.repair_tools.find_small_faces(design.bodies) assert len(problem_areas) == 4 @@ -191,7 +192,8 @@ def test_find_small_faces(modeler: Modeler): def test_find_small_face_id(modeler: Modeler): """Test whether problem area has the id.""" - skip_if_linux(modeler, test_find_small_face_id.__name__, "repair_tools") # Skip test on Linux + # Skip test on CoreService + skip_if_core_service(modeler, test_find_small_face_id.__name__, "repair_tools") design = modeler.open_file(FILES_DIR / "SmallFacesBefore.scdocx") problem_areas = modeler.repair_tools.find_small_faces(design.bodies) assert problem_areas[0].id != "0" @@ -201,9 +203,9 @@ def test_find_small_face_faces(modeler: Modeler): """Test to read geometry, find it's small face problem area and return connected faces. """ - skip_if_linux( + skip_if_core_service( modeler, test_find_small_face_faces.__name__, "repair_tools" - ) # Skip test on Linux + ) # Skip test on CoreService design = modeler.open_file(FILES_DIR / "SmallFacesBefore.scdocx") problem_areas = modeler.repair_tools.find_small_faces(design.bodies) assert len(problem_areas[0].faces) > 0 @@ -211,7 +213,8 @@ def test_find_small_face_faces(modeler: Modeler): def test_fix_small_face(modeler: Modeler): """Test to read geometry and find and fix it's small face problem areas.""" - skip_if_linux(modeler, test_fix_small_face.__name__, "repair_tools") # Skip test on Linux + # Skip test on CoreService + skip_if_core_service(modeler, test_fix_small_face.__name__, "repair_tools") design = modeler.open_file(FILES_DIR / "SmallFacesBefore.scdocx") problem_areas = modeler.repair_tools.find_small_faces(design.bodies) assert problem_areas[0].fix().success is True diff --git a/tests/integration/test_runscript.py b/tests/integration/test_runscript.py index ab5fe5717d..f0c0ce0e41 100644 --- a/tests/integration/test_runscript.py +++ b/tests/integration/test_runscript.py @@ -30,13 +30,13 @@ from ansys.geometry.core.math.point import Point2D from ansys.geometry.core.sketch import Sketch -from .conftest import DSCOSCRIPTS_FILES_DIR, skip_if_linux +from .conftest import DSCOSCRIPTS_FILES_DIR, skip_if_core_service # Python (.py) def test_python_simple_script(modeler: Modeler): - # Skip on Linux - skip_if_linux(modeler, test_python_simple_script.__name__, "run_discovery_script_file") + # Skip on CoreService + skip_if_core_service(modeler, test_python_simple_script.__name__, "run_discovery_script_file") result = modeler.run_discovery_script_file(DSCOSCRIPTS_FILES_DIR / "simple_script.py") pattern_db = re.compile(r"SpaceClaim\.Api\.[A-Za-z0-9]+\.DesignBody", re.IGNORECASE) @@ -49,8 +49,8 @@ def test_python_simple_script(modeler: Modeler): def test_python_simple_script_ignore_api_version( modeler: Modeler, caplog: pytest.LogCaptureFixture ): - # Skip on Linux - skip_if_linux( + # Skip on CoreService + skip_if_core_service( modeler, test_python_simple_script_ignore_api_version.__name__, "run_discovery_script_file" ) @@ -73,15 +73,17 @@ def test_python_simple_script_ignore_api_version( def test_python_failing_script(modeler: Modeler): - # Skip on Linux - skip_if_linux(modeler, test_python_failing_script.__name__, "run_discovery_script_file") + # Skip on CoreService + skip_if_core_service(modeler, test_python_failing_script.__name__, "run_discovery_script_file") with pytest.raises(GeometryRuntimeError): modeler.run_discovery_script_file(DSCOSCRIPTS_FILES_DIR / "failing_script.py") def test_python_integrated_script(modeler: Modeler): - # Skip on Linux - skip_if_linux(modeler, test_python_integrated_script.__name__, "run_discovery_script_file") + # Skip on CoreService + skip_if_core_service( + modeler, test_python_integrated_script.__name__, "run_discovery_script_file" + ) # Tests the workflow of creating a design in PyAnsys Geometry, modifying it with a script, # and continuing to use it in PyAnsys Geometry @@ -103,8 +105,8 @@ def test_python_integrated_script(modeler: Modeler): # SpaceClaim (.scscript) def test_scscript_simple_script(modeler: Modeler): - # Skip on Linux - skip_if_linux(modeler, test_scscript_simple_script.__name__, "run_discovery_script_file") + # Skip on CoreService + skip_if_core_service(modeler, test_scscript_simple_script.__name__, "run_discovery_script_file") result = modeler.run_discovery_script_file(DSCOSCRIPTS_FILES_DIR / "simple_script.scscript") assert len(result) == 2 @@ -117,8 +119,8 @@ def test_scscript_simple_script(modeler: Modeler): # Discovery (.dscript) def test_dscript_simple_script(modeler: Modeler): - # Skip on Linux - skip_if_linux(modeler, test_dscript_simple_script.__name__, "run_discovery_script_file") + # Skip on CoreService + skip_if_core_service(modeler, test_dscript_simple_script.__name__, "run_discovery_script_file") result = modeler.run_discovery_script_file(DSCOSCRIPTS_FILES_DIR / "simple_script.dscript") assert len(result) == 2 diff --git a/tests/integration/test_tessellation.py b/tests/integration/test_tessellation.py index 2e9f12a563..2e1d536b5f 100644 --- a/tests/integration/test_tessellation.py +++ b/tests/integration/test_tessellation.py @@ -69,7 +69,7 @@ def test_body_tessellate(modeler: Modeler): blocks_2 = body_2.tessellate() assert "MultiBlock" in str(blocks_2) assert blocks_2.n_blocks == 3 - if modeler.client.backend_type != BackendType.LINUX_SERVICE: + if not BackendType.is_core_service(modeler.client.backend_type): assert blocks_2.bounds == pytest.approx( [0.019999999999999997, 0.04, 0.020151922469877917, 0.03984807753012208, 0.0, 0.03], rel=1e-6, @@ -86,7 +86,7 @@ def test_body_tessellate(modeler: Modeler): # Tessellate the body merging the individual faces mesh_2 = body_2.tessellate(merge=True) - if modeler.client.backend_type != BackendType.LINUX_SERVICE: + if not BackendType.is_core_service(modeler.client.backend_type): assert "PolyData" in str(mesh_2) assert mesh_2.n_cells == 72 assert mesh_2.n_points == 76 diff --git a/tests/integration/test_trimmed_geometry.py b/tests/integration/test_trimmed_geometry.py index 30715083b3..7a3ff0920a 100644 --- a/tests/integration/test_trimmed_geometry.py +++ b/tests/integration/test_trimmed_geometry.py @@ -87,7 +87,7 @@ def create_hedgehog(modeler: Modeler): create_sketch_line(design, p1, p2) current_gap += 1 # Add isoparametric curves, not on linux - if modeler.client.backend_type != BackendType.LINUX_SERVICE: + if not BackendType.is_core_service(modeler.client.backend_type): param = 0.20 while param <= 1: for face in body.faces: