Skip to content

Commit 1688b2e

Browse files
b-matteoCopilotpre-commit-ci[bot]pyansys-ci-botRobPasMue
authored
fix: add skip_if_discovery method (#2202)
Co-authored-by: Copilot <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: pyansys-ci-bot <[email protected]> Co-authored-by: Roberto Pastor Muela <[email protected]>
1 parent f8d478a commit 1688b2e

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

doc/changelog.d/2202.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add skip_if_discovery method

tests/integration/conftest.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,17 @@ def skip_if_spaceclaim(modeler: Modeler, test_name: str, element_not_available:
8787
) # skip!
8888

8989

90+
def skip_if_discovery(modeler: Modeler, test_name: str, element_not_available: str):
91+
"""Skip test if running on Discovery."""
92+
if (
93+
modeler.client.backend_type == BackendType.DISCOVERY
94+
or modeler.client.backend_type == BackendType.DISCOVERY_HEADLESS
95+
):
96+
pytest.skip(
97+
reason=f"Skipping '{test_name}'. '{element_not_available}' not on Discovery."
98+
) # skip!
99+
100+
90101
@pytest.fixture(scope="session")
91102
def docker_instance(use_existing_service):
92103
# This will only have a value in case that:

tests/integration/test_design_export.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from .conftest import (
3737
FILES_DIR,
3838
skip_if_core_service,
39+
skip_if_discovery,
3940
skip_if_spaceclaim,
4041
skip_if_windows,
4142
)
@@ -160,6 +161,10 @@ def _checker_method(comp: Component, comp_ref: Component, precise_check: bool =
160161

161162
def test_export_to_scdocx(modeler: Modeler, tmp_path_factory: pytest.TempPathFactory):
162163
"""Test exporting a design to scdocx format."""
164+
skip_if_discovery(
165+
modeler, test_export_to_scdocx.__name__, "SCDOCX format"
166+
) # Skip test on Discovery
167+
163168
# Create a demo design
164169
design = _create_demo_design(modeler)
165170

@@ -319,6 +324,7 @@ def test_export_to_iges(modeler: Modeler, tmp_path_factory: pytest.TempPathFacto
319324

320325
def test_export_to_fmd(modeler: Modeler, tmp_path_factory: pytest.TempPathFactory):
321326
"""Test exporting a design to FMD format."""
327+
skip_if_discovery(modeler, test_export_to_fmd.__name__, "FMD format") # Skip test on Discovery
322328

323329
# Create a demo design
324330
design = _create_demo_design(modeler)
@@ -360,6 +366,9 @@ def test_import_export_reimport_design_scdocx(
360366
modeler: Modeler, tmp_path_factory: pytest.TempPathFactory
361367
):
362368
"""Test importing, exporting, and re-importing a design file."""
369+
skip_if_discovery(
370+
modeler, test_import_export_reimport_design_scdocx.__name__, "SCDOCX format"
371+
) # Skip test on Discovery
363372
# Define the working directory and file paths
364373
working_directory = tmp_path_factory.mktemp("test_import_export_reimport")
365374
original_file = Path(FILES_DIR, "reactorWNS.scdocx")
@@ -457,6 +466,9 @@ def test_import_export_open_file_design(
457466
expected_bodies,
458467
):
459468
"""Test importing, exporting, and opening a file in a new design."""
469+
skip_if_discovery(
470+
modeler, test_import_export_open_file_design.__name__, "design"
471+
) # Skip test on Discovery
460472
# Define the working directory and file paths
461473
working_directory = tmp_path_factory.mktemp("test_import_export_reimport")
462474
original_file_path = Path(FILES_DIR, original_file)

0 commit comments

Comments
 (0)