-
Notifications
You must be signed in to change notification settings - Fork 20
test: adding test coverage for modeler, plotting, logger, and parameters #2108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
tests/integration/test_plotter.py
Outdated
def test_adding_to_plotter(modeler: Modeler, verify_image_cache): | ||
"""Testing out adding things to an existing plotter while changing the color and is suppressed""" | ||
plotter = GeometryPlotter(allow_picking=True) | ||
plane = Plane(origin=[0, 0, 0], direction_x=[1, 0, 0], direction_y=[0, 1, 0]) | ||
box_plane = Sketch(plane=plane) | ||
plotting_options = {"clipping_plane": True} | ||
plotter.add_sketch(box_plane, show_plane=True, show_frame=True, **plotting_options) | ||
design = modeler.create_design("Box") | ||
box_plane.box(Point2D([0.0, 0.0]), width=1, height=1) | ||
box = design.extrude_sketch("Box", box_plane, 1) | ||
box_plot = MeshObjectPlot(box, mesh=None) | ||
plotter.add_body_edges(box_plot) | ||
box.set_suppressed(True) | ||
plotter.add_body(box) | ||
box.set_suppressed(False) | ||
plotter.add_body(box) | ||
plotter.add_face(box.faces[0]) | ||
plotter2 = GeometryPlotter(allow_picking=True, use_service_colors=True) | ||
box.faces[0].color = "blue" | ||
plotter2.add_face(box.faces[0]) | ||
plotter.show(plotting_object=box) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test needs to include more clarifications of what we are trying to attempt. Also I see 2 separate plotters. Graphics tests should ideally contain one only. We should also create a screenshot so that pytest-pyvista plugin can verify that the screenshot is the same as the reference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created two tests, one for each plotter. Please let me know if I did the screenshots incorrectly
tests/integration/test_plotter.py
Outdated
"""@skip_no_xserver | ||
def test_export_glb_nofilename(modeler: Modeler, verify_image_cache): | ||
Test exporting a box to glb. | ||
# Create a Sketch | ||
sketch = Sketch() | ||
sketch.box(Point2D([10, 10], UNITS.mm), Quantity(10, UNITS.mm), Quantity(10, UNITS.mm)) | ||
|
||
# Create your design on the server side | ||
design = modeler.create_design("GLBBoxNoName") | ||
|
||
# Extrude the sketch to create a body | ||
box_body = design.extrude_sketch("JustABoxNoName", sketch, Quantity(10, UNITS.mm)) | ||
|
||
pl = GeometryPlotter() | ||
pl.plot(box_body) | ||
|
||
pl.export_glb(filename=None)""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this commented out test intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed it
tests/integration/test_plotter.py
Outdated
|
||
pl.export_glb(filename=None) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for adding this export? Just to verify the default name? We should verify that the file exists in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, to verify the default name if none is given
tests/test_logging.py
Outdated
@@ -38,6 +40,63 @@ | |||
LOG_LEVELS = {"CRITICAL": 50, "ERROR": 40, "WARNING": 30, "INFO": 20, "DEBUG": 10} | |||
|
|||
|
|||
def test_add_instance(): | |||
# Testing adding an instance logger while checking if log has certain key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docstrings for defining the tests should go with """content"""
instead of # content
tests/test_logging.py
Outdated
|
||
def test_custom_and_child_log(): | ||
# Testing out writing a child log and adding std handler to it | ||
custom_filename = os.path.join(os.getcwd(), "custom_geometry.log") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using the os
library for path handling, please use pathlib
and Path
objects
…b.com/ansys/pyansys-geometry into test/syscordan_logging_design_modeler
Description
adding test coverage for modeler, plotting, logger, and parameters
Checklist
feat: extrude circle to cylinder
)