Skip to content

Commit 3044faa

Browse files
RobPasMuepyansys-ci-botpre-commit-ci[bot]
authored
feat: verifying Linux service also accepts colors (#1451)
Co-authored-by: pyansys-ci-bot <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 4ab4835 commit 3044faa

File tree

5 files changed

+22
-25
lines changed

5 files changed

+22
-25
lines changed

.github/workflows/ci_cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ env:
1717
ANSRV_GEO_PORT: 700
1818
ANSRV_GEO_LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
1919
GEO_CONT_NAME: ans_geo
20-
RESET_IMAGE_CACHE: 3
20+
RESET_IMAGE_CACHE: 4
2121
IS_WORKFLOW_RUNNING: True
2222
ARTIFACTORY_VERSION: v251
2323

doc/changelog.d/1451.added.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
verifying Linux service also accepts colors

src/ansys/geometry/core/designer/body.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
ProjectCurvesRequest,
5555
)
5656
from ansys.api.geometry.v0.commands_pb2_grpc import CommandsStub
57-
from ansys.geometry.core.connection.backend import BackendType
5857
from ansys.geometry.core.connection.client import GrpcClient
5958
from ansys.geometry.core.connection.conversions import (
6059
frame_to_grpc_frame,
@@ -768,13 +767,7 @@ def color(self) -> str: # noqa: D102
768767
# Assigning default value first
769768
self._color = Color.DEFAULT.value
770769

771-
# TODO: Remove this check when the Linux service backend supports color setting
772-
# https://github.com/ansys/pyansys-geometry/issues/1383
773-
if self._grpc_client.backend_type == BackendType.LINUX_SERVICE:
774-
self._grpc_client.log.warning(
775-
"Colors are not supported in the Linux backend. Default value assigned..."
776-
)
777-
elif self._grpc_client.backend_version < (25, 1, 0): # pragma: no cover
770+
if self._grpc_client.backend_version < (25, 1, 0): # pragma: no cover
778771
# Server does not support color retrieval before version 25.1.0
779772
self._grpc_client.log.warning(
780773
"Server does not support color retrieval. Default value assigned..."
@@ -990,15 +983,6 @@ def set_color(self, color: str | tuple[float, float, float]) -> None:
990983
"""Set the color of the body."""
991984
self._grpc_client.log.debug(f"Setting body color of {self.id} to {color}.")
992985

993-
# TODO: Remove this check when the Linux service backend supports color setting
994-
# https://github.com/ansys/pyansys-geometry/issues/1383
995-
if self._grpc_client.backend_type == BackendType.LINUX_SERVICE:
996-
self._grpc_client.log.warning(
997-
"Setting color is not supported in the Linux service backend."
998-
)
999-
self._grpc_client.log.warning("Ignoring request...")
1000-
return
1001-
1002986
try:
1003987
if isinstance(color, tuple):
1004988
# Ensure that all elements are within 0-1 or 0-255 range

tests/integration/test_design.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2038,7 +2038,6 @@ def test_set_fill_style(modeler: Modeler):
20382038

20392039
def test_set_body_color(modeler: Modeler):
20402040
"""Test the getting and setting of body color."""
2041-
skip_if_linux(modeler, test_set_body_color.__name__, "set_color") # Skip test on Linux
20422041

20432042
design = modeler.create_design("RVE2")
20442043
unit = DEFAULT_UNITS.LENGTH

tests/integration/test_plotter.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ def test_visualization_polydata():
664664
assert box.visualization_polydata.n_open_edges == 4
665665

666666

667+
@skip_no_xserver
667668
def test_plot_design_point(modeler: Modeler, verify_image_cache):
668669
"""Test the plotting of DesignPoint objects."""
669670
design = modeler.create_design("Multiplot")
@@ -690,7 +691,8 @@ def test_plot_design_point(modeler: Modeler, verify_image_cache):
690691
)
691692

692693

693-
def test_plot_revolve_sketch_normal(modeler: Modeler):
694+
@skip_no_xserver
695+
def test_plot_revolve_sketch_normal(modeler: Modeler, verify_image_cache):
694696
"""Test plotting of a sketch revolved around an axis."""
695697
# Initialize the donut sketch design
696698
design = modeler.create_design("quarter-donut")
@@ -725,7 +727,8 @@ def test_plot_revolve_sketch_normal(modeler: Modeler):
725727
)
726728

727729

728-
def test_plot_revolve_sketch_negative_angle(modeler: Modeler):
730+
@skip_no_xserver
731+
def test_plot_revolve_sketch_negative_angle(modeler: Modeler, verify_image_cache):
729732
"""Test plotting of a sketch revolved around an axis with a negative
730733
angle.
731734
"""
@@ -762,7 +765,10 @@ def test_plot_revolve_sketch_negative_angle(modeler: Modeler):
762765
)
763766

764767

765-
def test_plot_server_colors_on_design(modeler: Modeler, use_service_colors: None):
768+
@skip_no_xserver
769+
def test_plot_server_colors_on_design(
770+
modeler: Modeler, use_service_colors: None, verify_image_cache
771+
):
766772
"""Test plotting of a design with server colors."""
767773
# The following design is created:
768774
#
@@ -797,7 +803,10 @@ def test_plot_server_colors_on_design(modeler: Modeler, use_service_colors: None
797803
design.plot(screenshot=Path(IMAGE_RESULTS_DIR, "plot_server_colors_on_design.png"))
798804

799805

800-
def test_plot_server_color_on_single_body(modeler: Modeler, use_service_colors: None):
806+
@skip_no_xserver
807+
def test_plot_server_color_on_single_body(
808+
modeler: Modeler, use_service_colors: None, verify_image_cache
809+
):
801810
"""Test plotting of a single body with server colors."""
802811
design = modeler.create_design("ServerColorsBody")
803812

@@ -810,7 +819,10 @@ def test_plot_server_color_on_single_body(modeler: Modeler, use_service_colors:
810819
body.plot(screenshot=Path(IMAGE_RESULTS_DIR, "plot_server_color_on_single_body.png"))
811820

812821

813-
def test_plot_server_colors_on_design_using_input(modeler: Modeler, use_service_colors: None):
822+
@skip_no_xserver
823+
def test_plot_server_colors_on_design_using_input(
824+
modeler: Modeler, use_service_colors: None, verify_image_cache
825+
):
814826
"""Test plotting of a design with server colors (via argument)."""
815827
# The following design is created:
816828
#
@@ -848,7 +860,8 @@ def test_plot_server_colors_on_design_using_input(modeler: Modeler, use_service_
848860
)
849861

850862

851-
def test_plot_server_color_on_single_body_using_input(modeler: Modeler):
863+
@skip_no_xserver
864+
def test_plot_server_color_on_single_body_using_input(modeler: Modeler, verify_image_cache):
852865
"""Test plotting of a single body with server colors (via argument)."""
853866
design = modeler.create_design("ServerColorsBodyUsingInput")
854867

0 commit comments

Comments
 (0)