From 9b33928ca01e466f3ca95b4071f653e5fcecdf6c Mon Sep 17 00:00:00 2001 From: afernand Date: Tue, 27 Jun 2023 11:10:10 +0200 Subject: [PATCH 1/2] Add windows skip marker --- tests/conftest.py | 6 +++++ tests/test_elbow_scdoc.py | 50 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 tests/test_elbow_scdoc.py diff --git a/tests/conftest.py b/tests/conftest.py index 86e6e955c0..7c9c917654 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,6 @@ """General fixtures to use in all test modules.""" import os +import platform import xml.etree.ElementTree as ET import pytest @@ -7,6 +8,8 @@ import ansys.meshing.prime as prime from ansys.meshing.prime.examples import download_test_examples +windows_only = pytest.mark.skipif(platform.system() != 'nt', reason="Flaky Mac tests") + class RemoteClientManager: """Manager class for starting and closing the remote client of @@ -91,6 +94,9 @@ def get_examples(): bracket = prime.examples.download_bracket_fmd() examples_dict["bracket"] = bracket + mixing_elbow_windows = prime.examples.download_elbow_scdoc() + examples_dict["elbow_lucid_scdoc"] = mixing_elbow_windows + return examples_dict diff --git a/tests/test_elbow_scdoc.py b/tests/test_elbow_scdoc.py new file mode 100644 index 0000000000..9b12dafdd0 --- /dev/null +++ b/tests/test_elbow_scdoc.py @@ -0,0 +1,50 @@ +import os +import tempfile + +import pytest + +from ansys.meshing import prime +from ansys.meshing.prime.graphics import Graphics + + +@pytest.mark.windows_only +def test_elbow_lucid(get_remote_client, get_examples): + """Tests an use case with the elbow example.""" + + model = get_remote_client.model + prime_client = prime.launch_prime() + mesh_util = prime.lucid.Mesh(model=model) + + mixing_elbow = get_examples["elbow_lucid_scdoc"] + mesh_util.read(file_name=mixing_elbow) + mesh_util.create_zones_from_labels("inlet,outlet") + + mesh_util.surface_mesh(min_size=5, max_size=20) + + mesh_util.volume_mesh( + volume_fill_type=prime.VolumeFillType.POLY, + prism_surface_expression="* !inlet !outlet", + prism_layers=3, + ) + + display = Graphics(model=model) + display() + + part = model.get_part_by_name("flow_volume") + + part_summary_res = part.get_summary(prime.PartSummaryParams(model=model)) + + search = prime.VolumeSearch(model=model) + params = prime.VolumeQualitySummaryParams( + model=model, + scope=prime.ScopeDefinition(model=model, part_expression="*"), + cell_quality_measures=[prime.CellQualityMeasure.SKEWNESS], + quality_limit=[0.95], + ) + results = search.get_volume_quality_summary(params=params) + + with tempfile.TemporaryDirectory() as temp_folder: + mesh_file = os.path.join(temp_folder, "mixing_elbow.cas") + mesh_util.write(mesh_file) + assert os.path.exists(mesh_file) + prime_client.exit() From 34645a4554b16e2702b2cc6fbe839df937ef4f96 Mon Sep 17 00:00:00 2001 From: afernand Date: Tue, 27 Jun 2023 11:32:12 +0200 Subject: [PATCH 2/2] Fix skipif statement --- tests/conftest.py | 3 --- tests/test_elbow_scdoc.py | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 7c9c917654..f354edd9f0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,5 @@ """General fixtures to use in all test modules.""" import os -import platform import xml.etree.ElementTree as ET import pytest @@ -8,8 +7,6 @@ import ansys.meshing.prime as prime from ansys.meshing.prime.examples import download_test_examples -windows_only = pytest.mark.skipif(platform.system() != 'nt', reason="Flaky Mac tests") - class RemoteClientManager: """Manager class for starting and closing the remote client of diff --git a/tests/test_elbow_scdoc.py b/tests/test_elbow_scdoc.py index 9b12dafdd0..a9f235b4fb 100644 --- a/tests/test_elbow_scdoc.py +++ b/tests/test_elbow_scdoc.py @@ -1,4 +1,5 @@ import os +import platform import tempfile import pytest @@ -7,7 +8,7 @@ from ansys.meshing.prime.graphics import Graphics -@pytest.mark.windows_only +@pytest.mark.skipif(platform.system() != 'Windows', reason="Windows specific test.") def test_elbow_lucid(get_remote_client, get_examples): """Tests an use case with the elbow example."""