diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index 1683d07d5e..eb62d83bf2 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -24,7 +24,7 @@ body: required: true - label: I am using a [Python virtual environment](https://docs.python.org/3/library/venv.html). required: true - - label: I am using the [latest version of PyMAPDL](https://github.com/ansys/pymapdl/releases) and its dependencies (fully updated virtual environment). You can update them using ``pip install --upgrade --upgrade-strategy eager ansys-mapdl-core``. + - label: I am using the [latest version of PyMAPDL](https://github.com/ansys/pymapdl/releases) and its dependencies (fully updated virtual environment). You can update them using ``pip install --upgrade --upgrade-strategy eager ansys-mapdl-core`` in your activated virtual environment. required: true - type: textarea diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9baa814a7c..a35739975a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -360,6 +360,7 @@ jobs: if [[ "${{ matrix.mapdl-version }}" == *"ubuntu"* ]]; then export ON_UBUNTU=true;fi xvfb-run pytest \ ${{ env.PYTEST_ARGUMENTS }} \ + --ignore_image_cache \ --cov-report=xml:centos-${{ matrix.mapdl-version }}-remote.xml - uses: codecov/codecov-action@v3 @@ -516,7 +517,7 @@ jobs: export AWP_ROOT222=/ansys_inc xvfb-run pytest -k "not test_database and not test_dpf" \ ${{ env.PYTEST_ARGUMENTS }} \ - --reset_only_failed \ + --reset_only_failed --add_missing_images \ --cov-report=xml:ubuntu-v22.2.0-local.xml - name: "Adding the directory as safe directory for later step" @@ -620,7 +621,7 @@ jobs: set PYMAPDL_START_INSTANCE= python -m pytest -k "not test_database and not test_dpf" \ ${{ env.PYTEST_ARGUMENTS }} \ - --skip-regression-check \ + --ignore_image_cache \ --cov-report=xml:windows-v22.2.0-local.xml - uses: codecov/codecov-action@v3 diff --git a/doc/source/conf.py b/doc/source/conf.py index e21410a8e0..02b9e8ce4b 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -3,7 +3,12 @@ import os import warnings -from ansys_sphinx_theme import ansys_favicon, get_version_match, pyansys_logo_black +from ansys_sphinx_theme import ( + ansys_favicon, + get_version_match, + pyansys_logo_black, + pyansys_logo_white, +) import numpy as np import pyvista from sphinx.application import Sphinx @@ -236,6 +241,8 @@ "image_scrapers": ("pyvista", "matplotlib"), "ignore_pattern": "flycheck*", "thumbnail_size": (350, 350), + "remove_config_comments": True, + "default_thumb_file": pyansys_logo_white, } # --- diff --git a/doc/source/getting_started/wsl.rst b/doc/source/getting_started/wsl.rst index 693ef03430..ec6d8c976d 100644 --- a/doc/source/getting_started/wsl.rst +++ b/doc/source/getting_started/wsl.rst @@ -18,7 +18,7 @@ show how to use it together with MAPDL, PyMAPDL, and `Docker `_. + find any issues or have questions related to WSL, feel free to `open an issue in the GitHub repository `_. Install WSL diff --git a/examples/00-mapdl-examples/BodyFlux-Averaging.py b/examples/00-mapdl-examples/2d_magnetostatic_solenoid-BodyFlux_Averaging.py similarity index 98% rename from examples/00-mapdl-examples/BodyFlux-Averaging.py rename to examples/00-mapdl-examples/2d_magnetostatic_solenoid-BodyFlux_Averaging.py index 4736d45270..03d6df883f 100644 --- a/examples/00-mapdl-examples/BodyFlux-Averaging.py +++ b/examples/00-mapdl-examples/2d_magnetostatic_solenoid-BodyFlux_Averaging.py @@ -56,6 +56,8 @@ The Power Graphics style plot is then set up via PyVista. """ +# sphinx_gallery_thumbnail_path = './_static/model_solenoid_2d.png' + import numpy as np import pyvista as pv @@ -292,9 +294,9 @@ plotter = pv.Plotter() -for i in range(0, len(grids)): +for i, grid in enumerate(grids): plotter.add_mesh( - grids[i], + grid, scalars=scalars[i], show_edges=True, cmap=PyMAPDL_cmap, diff --git a/examples/01-geometry/00-keypoints.py b/examples/01-geometry/00-keypoints.py index 15810d294f..05dc21505b 100644 --- a/examples/01-geometry/00-keypoints.py +++ b/examples/01-geometry/00-keypoints.py @@ -149,7 +149,7 @@ # plotting methods. mapdl.kplot( show_keypoint_numbering=True, - background="black", + background="white", show_bounds=True, font_size=26, ) diff --git a/src/ansys/mapdl/core/examples/__init__.py b/src/ansys/mapdl/core/examples/__init__.py index 497c14d3b4..f032b438e8 100644 --- a/src/ansys/mapdl/core/examples/__init__.py +++ b/src/ansys/mapdl/core/examples/__init__.py @@ -1,4 +1,6 @@ -from .downloads import * -from .downloads import _download_rotor_tech_demo_plot, download_cfx_mapping_example_data -from .examples import * +from .downloads import ( + download_bracket, + download_cfx_mapping_example_data, + download_manifold_example_data, +) from .verif_files import vmfiles diff --git a/src/ansys/mapdl/core/examples/downloads.py b/src/ansys/mapdl/core/examples/downloads.py index 4648315785..bdae6c01e8 100644 --- a/src/ansys/mapdl/core/examples/downloads.py +++ b/src/ansys/mapdl/core/examples/downloads.py @@ -124,7 +124,7 @@ def download_vtk_rotor(): return _download_file("rotor.vtk", "geometry")[0] -def _download_rotor_tech_demo_plot(): +def _download_rotor_tech_demo_vtk(): """Download the rotor surface VTK file.""" return _download_file("rotor2.vtk", "geometry")[0] diff --git a/tests/.image_cache/aplot[False].png b/tests/.image_cache/aplot[False].png index 059886a90a..a295a6edf7 100644 Binary files a/tests/.image_cache/aplot[False].png and b/tests/.image_cache/aplot[False].png differ diff --git a/tests/.image_cache/aplot[False]_1.png b/tests/.image_cache/aplot[False]_1.png index 6612e3df48..9d4a4a9cf1 100644 Binary files a/tests/.image_cache/aplot[False]_1.png and b/tests/.image_cache/aplot[False]_1.png differ diff --git a/tests/.image_cache/aplot[False]_2.png b/tests/.image_cache/aplot[False]_2.png index e276be7ca0..8137f77a24 100644 Binary files a/tests/.image_cache/aplot[False]_2.png and b/tests/.image_cache/aplot[False]_2.png differ diff --git a/tests/.image_cache/aplot[None].png b/tests/.image_cache/aplot[None].png index 059886a90a..a295a6edf7 100644 Binary files a/tests/.image_cache/aplot[None].png and b/tests/.image_cache/aplot[None].png differ diff --git a/tests/.image_cache/aplot[None]_1.png b/tests/.image_cache/aplot[None]_1.png index 6612e3df48..e2f2eafb96 100644 Binary files a/tests/.image_cache/aplot[None]_1.png and b/tests/.image_cache/aplot[None]_1.png differ diff --git a/tests/.image_cache/aplot[None]_2.png b/tests/.image_cache/aplot[None]_2.png index e276be7ca0..9d4a4a9cf1 100644 Binary files a/tests/.image_cache/aplot[None]_2.png and b/tests/.image_cache/aplot[None]_2.png differ diff --git a/tests/.image_cache/aplot[None]_3.png b/tests/.image_cache/aplot[None]_3.png index e276be7ca0..8137f77a24 100644 Binary files a/tests/.image_cache/aplot[None]_3.png and b/tests/.image_cache/aplot[None]_3.png differ diff --git a/tests/.image_cache/aplot[True].png b/tests/.image_cache/aplot[True].png index 059886a90a..a295a6edf7 100644 Binary files a/tests/.image_cache/aplot[True].png and b/tests/.image_cache/aplot[True].png differ diff --git a/tests/.image_cache/aplot[True]_1.png b/tests/.image_cache/aplot[True]_1.png index 6612e3df48..1c96c08053 100644 Binary files a/tests/.image_cache/aplot[True]_1.png and b/tests/.image_cache/aplot[True]_1.png differ diff --git a/tests/.image_cache/aplot[True]_2.png b/tests/.image_cache/aplot[True]_2.png index e276be7ca0..9d4a4a9cf1 100644 Binary files a/tests/.image_cache/aplot[True]_2.png and b/tests/.image_cache/aplot[True]_2.png differ diff --git a/tests/.image_cache/aplot[True]_3.png b/tests/.image_cache/aplot[True]_3.png index e276be7ca0..8137f77a24 100644 Binary files a/tests/.image_cache/aplot[True]_3.png and b/tests/.image_cache/aplot[True]_3.png differ diff --git a/tests/.image_cache/background.png b/tests/.image_cache/background.png new file mode 100644 index 0000000000..7b526a6f94 Binary files /dev/null and b/tests/.image_cache/background.png differ diff --git a/tests/.image_cache/bc_plot_bc_labels[CSGZ].png b/tests/.image_cache/bc_plot_bc_labels[CSGZ].png new file mode 100644 index 0000000000..78bc33e79c Binary files /dev/null and b/tests/.image_cache/bc_plot_bc_labels[CSGZ].png differ diff --git a/tests/.image_cache/bc_plot_bc_labels[Mechanical].png b/tests/.image_cache/bc_plot_bc_labels[Mechanical].png new file mode 100644 index 0000000000..af68f36f02 Binary files /dev/null and b/tests/.image_cache/bc_plot_bc_labels[Mechanical].png differ diff --git a/tests/.image_cache/bc_plot_bc_labels[bc_labels0].png b/tests/.image_cache/bc_plot_bc_labels[bc_labels0].png new file mode 100644 index 0000000000..0f6d7e633b Binary files /dev/null and b/tests/.image_cache/bc_plot_bc_labels[bc_labels0].png differ diff --git a/tests/.image_cache/bc_plot_bc_labels[bc_labels1].png b/tests/.image_cache/bc_plot_bc_labels[bc_labels1].png new file mode 100644 index 0000000000..0f6d7e633b Binary files /dev/null and b/tests/.image_cache/bc_plot_bc_labels[bc_labels1].png differ diff --git a/tests/.image_cache/bc_plot_bc_labels[bc_labels2].png b/tests/.image_cache/bc_plot_bc_labels[bc_labels2].png new file mode 100644 index 0000000000..0f6d7e633b Binary files /dev/null and b/tests/.image_cache/bc_plot_bc_labels[bc_labels2].png differ diff --git a/tests/.image_cache/bc_plot_bc_labels[bc_labels3].png b/tests/.image_cache/bc_plot_bc_labels[bc_labels3].png new file mode 100644 index 0000000000..5908f253b6 Binary files /dev/null and b/tests/.image_cache/bc_plot_bc_labels[bc_labels3].png differ diff --git a/tests/.image_cache/bc_plot_bc_labels[bc_labels4].png b/tests/.image_cache/bc_plot_bc_labels[bc_labels4].png new file mode 100644 index 0000000000..5908f253b6 Binary files /dev/null and b/tests/.image_cache/bc_plot_bc_labels[bc_labels4].png differ diff --git a/tests/.image_cache/bc_plot_bc_labels[bc_labels5].png b/tests/.image_cache/bc_plot_bc_labels[bc_labels5].png new file mode 100644 index 0000000000..5d62d14e5c Binary files /dev/null and b/tests/.image_cache/bc_plot_bc_labels[bc_labels5].png differ diff --git a/tests/.image_cache/bc_plot_bc_labels[bc_labels6].png b/tests/.image_cache/bc_plot_bc_labels[bc_labels6].png new file mode 100644 index 0000000000..56cfd8890e Binary files /dev/null and b/tests/.image_cache/bc_plot_bc_labels[bc_labels6].png differ diff --git a/tests/.image_cache/bc_plot_bc_labels[ux].png b/tests/.image_cache/bc_plot_bc_labels[ux].png new file mode 100644 index 0000000000..b9722c3001 Binary files /dev/null and b/tests/.image_cache/bc_plot_bc_labels[ux].png differ diff --git a/tests/.image_cache/bc_plot_bc_target[Nodes].png b/tests/.image_cache/bc_plot_bc_target[Nodes].png new file mode 100644 index 0000000000..0f6d7e633b Binary files /dev/null and b/tests/.image_cache/bc_plot_bc_target[Nodes].png differ diff --git a/tests/.image_cache/bc_plot_bc_target[bc_target0].png b/tests/.image_cache/bc_plot_bc_target[bc_target0].png new file mode 100644 index 0000000000..0f6d7e633b Binary files /dev/null and b/tests/.image_cache/bc_plot_bc_target[bc_target0].png differ diff --git a/tests/.image_cache/bc_plot_bc_target[bc_target1].png b/tests/.image_cache/bc_plot_bc_target[bc_target1].png new file mode 100644 index 0000000000..0f6d7e633b Binary files /dev/null and b/tests/.image_cache/bc_plot_bc_target[bc_target1].png differ diff --git a/tests/.image_cache/bc_plot_options[False-False-False].png b/tests/.image_cache/bc_plot_options[False-False-False].png index b12c67aadb..996436574d 100644 Binary files a/tests/.image_cache/bc_plot_options[False-False-False].png and b/tests/.image_cache/bc_plot_options[False-False-False].png differ diff --git a/tests/.image_cache/bc_plot_options[False-False-True].png b/tests/.image_cache/bc_plot_options[False-False-True].png new file mode 100644 index 0000000000..996436574d Binary files /dev/null and b/tests/.image_cache/bc_plot_options[False-False-True].png differ diff --git a/tests/.image_cache/bc_plot_options[False-True-False].png b/tests/.image_cache/bc_plot_options[False-True-False].png index 5b806fe57a..ae4246015d 100644 Binary files a/tests/.image_cache/bc_plot_options[False-True-False].png and b/tests/.image_cache/bc_plot_options[False-True-False].png differ diff --git a/tests/.image_cache/bc_plot_options[False-True-True].png b/tests/.image_cache/bc_plot_options[False-True-True].png new file mode 100644 index 0000000000..ae4246015d Binary files /dev/null and b/tests/.image_cache/bc_plot_options[False-True-True].png differ diff --git a/tests/.image_cache/bc_plot_options[True-False-False].png b/tests/.image_cache/bc_plot_options[True-False-False].png index c5f36f3fd0..491c8d3f1f 100644 Binary files a/tests/.image_cache/bc_plot_options[True-False-False].png and b/tests/.image_cache/bc_plot_options[True-False-False].png differ diff --git a/tests/.image_cache/bc_plot_options[True-False-True].png b/tests/.image_cache/bc_plot_options[True-False-True].png new file mode 100644 index 0000000000..491c8d3f1f Binary files /dev/null and b/tests/.image_cache/bc_plot_options[True-False-True].png differ diff --git a/tests/.image_cache/bc_plot_options[True-True-False].png b/tests/.image_cache/bc_plot_options[True-True-False].png index b98dad055f..55ef2b4e34 100644 Binary files a/tests/.image_cache/bc_plot_options[True-True-False].png and b/tests/.image_cache/bc_plot_options[True-True-False].png differ diff --git a/tests/.image_cache/bc_plot_options[True-True-True].png b/tests/.image_cache/bc_plot_options[True-True-True].png new file mode 100644 index 0000000000..55ef2b4e34 Binary files /dev/null and b/tests/.image_cache/bc_plot_options[True-True-True].png differ diff --git a/tests/.image_cache/cmplot_all[KP].png b/tests/.image_cache/cmplot_all[KP].png new file mode 100644 index 0000000000..3437e990cc Binary files /dev/null and b/tests/.image_cache/cmplot_all[KP].png differ diff --git a/tests/.image_cache/cmplot_all[NODE].png b/tests/.image_cache/cmplot_all[NODE].png new file mode 100644 index 0000000000..f17c5b9df4 Binary files /dev/null and b/tests/.image_cache/cmplot_all[NODE].png differ diff --git a/tests/.image_cache/cmplot_individual[AREA].png b/tests/.image_cache/cmplot_individual[AREA].png new file mode 100644 index 0000000000..098ff0ecd2 Binary files /dev/null and b/tests/.image_cache/cmplot_individual[AREA].png differ diff --git a/tests/.image_cache/cmplot_individual[ELEM].png b/tests/.image_cache/cmplot_individual[ELEM].png new file mode 100644 index 0000000000..90ea6c4505 Binary files /dev/null and b/tests/.image_cache/cmplot_individual[ELEM].png differ diff --git a/tests/.image_cache/cmplot_individual[KP].png b/tests/.image_cache/cmplot_individual[KP].png new file mode 100644 index 0000000000..e0bea1f797 Binary files /dev/null and b/tests/.image_cache/cmplot_individual[KP].png differ diff --git a/tests/.image_cache/cmplot_individual[LINE].png b/tests/.image_cache/cmplot_individual[LINE].png new file mode 100644 index 0000000000..2cf7b98318 Binary files /dev/null and b/tests/.image_cache/cmplot_individual[LINE].png differ diff --git a/tests/.image_cache/cmplot_individual[NODE].png b/tests/.image_cache/cmplot_individual[NODE].png new file mode 100644 index 0000000000..ade178faf5 Binary files /dev/null and b/tests/.image_cache/cmplot_individual[NODE].png differ diff --git a/tests/.image_cache/cmplot_individual[VOLU].png b/tests/.image_cache/cmplot_individual[VOLU].png new file mode 100644 index 0000000000..51a8bfa3c2 Binary files /dev/null and b/tests/.image_cache/cmplot_individual[VOLU].png differ diff --git a/tests/.image_cache/color_areas.png b/tests/.image_cache/color_areas.png new file mode 100644 index 0000000000..2f7d7419b2 Binary files /dev/null and b/tests/.image_cache/color_areas.png differ diff --git a/tests/.image_cache/color_areas_individual[color_areas0].png b/tests/.image_cache/color_areas_individual[color_areas0].png new file mode 100644 index 0000000000..c79e101436 Binary files /dev/null and b/tests/.image_cache/color_areas_individual[color_areas0].png differ diff --git a/tests/.image_cache/color_areas_individual[color_areas1].png b/tests/.image_cache/color_areas_individual[color_areas1].png new file mode 100644 index 0000000000..05102e006e Binary files /dev/null and b/tests/.image_cache/color_areas_individual[color_areas1].png differ diff --git a/tests/.image_cache/color_areas_individual[color_areas2].png b/tests/.image_cache/color_areas_individual[color_areas2].png new file mode 100644 index 0000000000..05102e006e Binary files /dev/null and b/tests/.image_cache/color_areas_individual[color_areas2].png differ diff --git a/tests/.image_cache/eplot[False].png b/tests/.image_cache/eplot[False].png index e513deb69b..05102e006e 100644 Binary files a/tests/.image_cache/eplot[False].png and b/tests/.image_cache/eplot[False].png differ diff --git a/tests/.image_cache/eplot[False]_1.png b/tests/.image_cache/eplot[False]_1.png index 0cfc49992e..3b1c8c643d 100644 Binary files a/tests/.image_cache/eplot[False]_1.png and b/tests/.image_cache/eplot[False]_1.png differ diff --git a/tests/.image_cache/eplot[False]_2.png b/tests/.image_cache/eplot[False]_2.png index e513deb69b..05102e006e 100644 Binary files a/tests/.image_cache/eplot[False]_2.png and b/tests/.image_cache/eplot[False]_2.png differ diff --git a/tests/.image_cache/eplot[None].png b/tests/.image_cache/eplot[None].png index e513deb69b..05102e006e 100644 Binary files a/tests/.image_cache/eplot[None].png and b/tests/.image_cache/eplot[None].png differ diff --git a/tests/.image_cache/eplot[None]_1.png b/tests/.image_cache/eplot[None]_1.png index 0cfc49992e..3b1c8c643d 100644 Binary files a/tests/.image_cache/eplot[None]_1.png and b/tests/.image_cache/eplot[None]_1.png differ diff --git a/tests/.image_cache/eplot[None]_2.png b/tests/.image_cache/eplot[None]_2.png index 0cfc49992e..3b1c8c643d 100644 Binary files a/tests/.image_cache/eplot[None]_2.png and b/tests/.image_cache/eplot[None]_2.png differ diff --git a/tests/.image_cache/eplot[None]_3.png b/tests/.image_cache/eplot[None]_3.png index e513deb69b..05102e006e 100644 Binary files a/tests/.image_cache/eplot[None]_3.png and b/tests/.image_cache/eplot[None]_3.png differ diff --git a/tests/.image_cache/eplot[True].png b/tests/.image_cache/eplot[True].png index e513deb69b..05102e006e 100644 Binary files a/tests/.image_cache/eplot[True].png and b/tests/.image_cache/eplot[True].png differ diff --git a/tests/.image_cache/eplot[True]_1.png b/tests/.image_cache/eplot[True]_1.png index 0cfc49992e..3b1c8c643d 100644 Binary files a/tests/.image_cache/eplot[True]_1.png and b/tests/.image_cache/eplot[True]_1.png differ diff --git a/tests/.image_cache/eplot[True]_2.png b/tests/.image_cache/eplot[True]_2.png index 0cfc49992e..3b1c8c643d 100644 Binary files a/tests/.image_cache/eplot[True]_2.png and b/tests/.image_cache/eplot[True]_2.png differ diff --git a/tests/.image_cache/eplot[True]_3.png b/tests/.image_cache/eplot[True]_3.png index e513deb69b..05102e006e 100644 Binary files a/tests/.image_cache/eplot[True]_3.png and b/tests/.image_cache/eplot[True]_3.png differ diff --git a/tests/.image_cache/eplot_savefig.png b/tests/.image_cache/eplot_savefig.png index fda0a8006b..5c0bb0056c 100644 Binary files a/tests/.image_cache/eplot_savefig.png and b/tests/.image_cache/eplot_savefig.png differ diff --git a/tests/.image_cache/kplot[None].png b/tests/.image_cache/kplot[None].png index b174dd9141..2b194c30aa 100644 Binary files a/tests/.image_cache/kplot[None].png and b/tests/.image_cache/kplot[None].png differ diff --git a/tests/.image_cache/kplot[True].png b/tests/.image_cache/kplot[True].png index b174dd9141..2b194c30aa 100644 Binary files a/tests/.image_cache/kplot[True].png and b/tests/.image_cache/kplot[True].png differ diff --git a/tests/.image_cache/lplot[None].png b/tests/.image_cache/lplot[None].png index 891728c451..df6b8f2493 100644 Binary files a/tests/.image_cache/lplot[None].png and b/tests/.image_cache/lplot[None].png differ diff --git a/tests/.image_cache/lplot[True].png b/tests/.image_cache/lplot[True].png index 891728c451..df6b8f2493 100644 Binary files a/tests/.image_cache/lplot[True].png and b/tests/.image_cache/lplot[True].png differ diff --git a/tests/.image_cache/nplot[None-False].png b/tests/.image_cache/nplot[None-False].png new file mode 100644 index 0000000000..d8afc6add1 Binary files /dev/null and b/tests/.image_cache/nplot[None-False].png differ diff --git a/tests/.image_cache/nplot[None-True].png b/tests/.image_cache/nplot[None-True].png new file mode 100644 index 0000000000..d8afc6add1 Binary files /dev/null and b/tests/.image_cache/nplot[None-True].png differ diff --git a/tests/.image_cache/nplot[True-False].png b/tests/.image_cache/nplot[True-False].png new file mode 100644 index 0000000000..d8afc6add1 Binary files /dev/null and b/tests/.image_cache/nplot[True-False].png differ diff --git a/tests/.image_cache/nplot[True-True].png b/tests/.image_cache/nplot[True-True].png new file mode 100644 index 0000000000..d8afc6add1 Binary files /dev/null and b/tests/.image_cache/nplot[True-True].png differ diff --git a/tests/.image_cache/plotter_input.png b/tests/.image_cache/plotter_input.png new file mode 100644 index 0000000000..b9504c78c3 Binary files /dev/null and b/tests/.image_cache/plotter_input.png differ diff --git a/tests/.image_cache/show_bounds.png b/tests/.image_cache/show_bounds.png new file mode 100644 index 0000000000..e67abb29cb Binary files /dev/null and b/tests/.image_cache/show_bounds.png differ diff --git a/tests/.image_cache/vplot[None].png b/tests/.image_cache/vplot[None].png new file mode 100644 index 0000000000..476f733d28 Binary files /dev/null and b/tests/.image_cache/vplot[None].png differ diff --git a/tests/.image_cache/vplot[True].png b/tests/.image_cache/vplot[True].png new file mode 100644 index 0000000000..476f733d28 Binary files /dev/null and b/tests/.image_cache/vplot[True].png differ diff --git a/tests/conftest.py b/tests/conftest.py index d11bdfdab3..1316fb292c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -15,6 +15,7 @@ from ansys.mapdl.core.errors import MapdlExitedError, MapdlRuntimeError from ansys.mapdl.core.examples import vmfiles from ansys.mapdl.core.launcher import get_start_instance, launch_mapdl +from ansys.mapdl.core.theme import _apply_default_theme from common import ( Element, Node, @@ -28,6 +29,8 @@ is_smp, ) +_apply_default_theme() + ################################################################ # # Setting testing environment @@ -209,9 +212,20 @@ def pytest_collection_modifyitems(config, items): @pytest.fixture(autouse=True) def wrapped_verify_image_cache(verify_image_cache, pytestconfig): + # Checking if we want to avoid the check using pytest cli. skip_regression_check = pytestconfig.option.skip_regression_check if skip_regression_check: verify_image_cache.skip = True + + # Configuration + # default check + verify_image_cache.error_value = 500.0 + verify_image_cache.warning_value = 200.0 + + # High variance test + verify_image_cache.var_error_value = 1000.0 + verify_image_cache.var_warning_value = 1000.0 + return verify_image_cache @@ -703,7 +717,6 @@ def contact_geom_and_mesh(mapdl): mapdl.vsweep("all") mapdl.allsel("all") - # mapdl.eplot() # ========================================================== # * Contact Pairs # ========================================================== @@ -745,12 +758,10 @@ def contact_geom_and_mesh(mapdl): mapdl.mat(1) mapdl.asel("s", "", "", 5) mapdl.nsla("", 1) - # mapdl.nplot() mapdl.cm("tn.cnt", "node") # Creating component on weld side of plate1 mapdl.asel("s", "", "", 12) mapdl.nsla("", 1) - # mapdl.nplot() mapdl.cm("tn.tgt", "node") # Creating component on weld side of plate2 mapdl.allsel("all") @@ -762,7 +773,6 @@ def contact_geom_and_mesh(mapdl): # for welding, 'C mapdl.real(6) mapdl.cmsel("s", "tn.cnt") - # mapdl.nplot() mapdl.esurf() mapdl.type(7) mapdl.real(6) @@ -939,7 +949,6 @@ def cuadratic_beam_problem(mapdl): mapdl.mp("EX", 1, 30e6) mapdl.mp("PRXY", 1, 0.3) - print(mapdl.mplist()) w_f = 1.048394965 w_w = 0.6856481 @@ -954,18 +963,9 @@ def cuadratic_beam_problem(mapdl): # Define one node for the orientation of the beam cross-section. orient_node = mapdl.n(6, 60, 1) - # Print the list of the created nodes. - print(mapdl.nlist()) - for elem_num in range(1, 5): mapdl.e(elem_num, elem_num + 1, orient_node) - # Print the list of the created elements. - print(mapdl.elist()) - - # Display elements with their nodes numbers. - mapdl.eplot(show_node_numbering=True, line_width=5, cpos="xy", font_size=40) - # BC for the beams seats mapdl.d(2, "UX", lab2="UY") mapdl.d(4, "UY") diff --git a/tests/test_examples.py b/tests/test_examples.py index 4fde5fb388..cebebe8b87 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -7,7 +7,7 @@ from ansys.mapdl.core import EXAMPLES_PATH, examples from ansys.mapdl.core.examples.downloads import ( _download_file, - _download_rotor_tech_demo_plot, + _download_rotor_tech_demo_vtk, check_directory_exist, delete_downloads, download_bracket, @@ -112,9 +112,9 @@ def test_download_vtk_rotor(running_test): assert download_vtk_rotor() is True -def test__download_rotor_tech_demo_plot(running_test): +def test__download_rotor_tech_demo_vtk(running_test): with running_test(): - assert _download_rotor_tech_demo_plot() is True + assert _download_rotor_tech_demo_vtk() is True def test_download_example_data(running_test): diff --git a/tests/test_geometry.py b/tests/test_geometry.py index acbe118e36..f597deab25 100644 --- a/tests/test_geometry.py +++ b/tests/test_geometry.py @@ -113,7 +113,7 @@ def test_vext(mapdl, cleared): carc0 = mapdl.circle(k0, 1, k1) a0 = mapdl.al(*carc0) - # next, extrude it and plot it + # next, and extrude it mapdl.vext(a0, dz=4) @@ -153,7 +153,7 @@ def test_va(mapdl, cleared): a2 = mapdl.a(k1, k2, k3) a3 = mapdl.a(k0, k2, k3) - # generate and plot the volume + # generate the volume vnum = mapdl.va(a0, a1, a2, a3) assert vnum == 1 diff --git a/tests/test_mapdl.py b/tests/test_mapdl.py index 9695b4c3ad..063b878162 100644 --- a/tests/test_mapdl.py +++ b/tests/test_mapdl.py @@ -32,7 +32,6 @@ QUICK_LAUNCH_SWITCHES, skip_if_not_local, skip_if_on_cicd, - skip_no_xserver, skip_on_windows, ) @@ -368,47 +367,6 @@ def test_invalid_input(mapdl): mapdl.input("thisisnotafile") -@skip_no_xserver -@pytest.mark.parametrize("vtk", [True, False, None]) -def test_kplot(cleared, mapdl, tmpdir, vtk): - mapdl.k("", 0, 0, 0) - mapdl.k("", 1, 0, 0) - mapdl.k("", 1, 1, 0) - mapdl.k("", 0, 1, 0) - - filename = str(tmpdir.mkdir("tmpdir").join("tmp.png")) - cpos = mapdl.kplot(vtk=vtk, savefig=filename) - assert cpos is None - if vtk: - assert os.path.isfile(filename) - - -@skip_no_xserver -@pytest.mark.parametrize("vtk", [True, False, None]) -def test_aplot(cleared, mapdl, vtk): - k0 = mapdl.k("", 0, 0, 0) - k1 = mapdl.k("", 1, 0, 0) - k2 = mapdl.k("", 1, 1, 0) - k3 = mapdl.k("", 0, 1, 0) - l0 = mapdl.l(k0, k1) - l1 = mapdl.l(k1, k2) - l2 = mapdl.l(k2, k3) - l3 = mapdl.l(k3, k0) - mapdl.al(l0, l1, l2, l3) - mapdl.aplot(show_area_numbering=True) - mapdl.aplot(color_areas=vtk, show_lines=True, show_line_numbering=True) - - mapdl.aplot(quality=100) - mapdl.aplot(quality=-1) - - -@skip_no_xserver -@pytest.mark.parametrize("vtk", [True, False, None]) -def test_vplot(cleared, mapdl, vtk): - mapdl.block(0, 1, 0, 1, 0, 1) - mapdl.vplot(vtk=vtk, color_areas=True) - - def test_keypoints(cleared, mapdl): assert mapdl.geometry.n_keypoint == 0 kps = [[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]] @@ -443,25 +401,6 @@ def test_lines(cleared, mapdl): assert mapdl.geometry.n_line == 4 -@skip_no_xserver -@pytest.mark.parametrize("vtk", [True, False, None]) -def test_lplot(cleared, mapdl, tmpdir, vtk): - k0 = mapdl.k("", 0, 0, 0) - k1 = mapdl.k("", 1, 0, 0) - k2 = mapdl.k("", 1, 1, 0) - k3 = mapdl.k("", 0, 1, 0) - mapdl.l(k0, k1) - mapdl.l(k1, k2) - mapdl.l(k2, k3) - mapdl.l(k3, k0) - - filename = str(tmpdir.mkdir("tmpdir").join("tmp.png")) - cpos = mapdl.lplot(vtk=vtk, show_keypoint_numbering=True, savefig=filename) - assert cpos is None - if vtk: - assert os.path.isfile(filename) - - @skip_if_not_local def test_apdl_logging_start(tmpdir): filename = str(tmpdir.mkdir("tmpdir").join("tmp.inp")) @@ -622,24 +561,6 @@ def test_enum(mapdl, make_block): assert np.allclose(mapdl.mesh.enum, range(1, mapdl.mesh.n_elem + 1)) -@pytest.mark.parametrize("nnum", [True, False]) -@pytest.mark.parametrize("vtk", [True, False, None]) -@skip_no_xserver -def test_nplot_vtk(cleared, mapdl, nnum, vtk): - mapdl.n(1, 0, 0, 0) - mapdl.n(11, 10, 0, 0) - mapdl.fill(1, 11, 9) - mapdl.nplot(vtk=vtk, nnum=nnum, background="w", color="k") - - -@skip_no_xserver -def test_nplot(cleared, mapdl): - mapdl.n(1, 0, 0, 0) - mapdl.n(11, 10, 0, 0) - mapdl.fill(1, 11, 9) - mapdl.nplot(vtk=False) - - def test_elements(cleared, mapdl): mapdl.et(1, 185) @@ -761,30 +682,6 @@ def test_builtin_parameters(mapdl, cleared): assert mapdl.parameters.real == 1 -@skip_no_xserver -@pytest.mark.parametrize("vtk", [True, False, None]) -def test_eplot(mapdl, make_block, vtk): - init_elem = mapdl.mesh.n_elem - mapdl.aplot() # check aplot and verify it doesn't mess up the element plotting - mapdl.eplot(show_node_numbering=True, background="w", color="b") - mapdl.eplot(vtk=vtk, show_node_numbering=True, background="w", color="b") - mapdl.aplot() # check aplot and verify it doesn't mess up the element plotting - assert mapdl.mesh.n_elem == init_elem - - -@skip_no_xserver -def test_eplot_savefig(mapdl, make_block, tmpdir): - filename = str(tmpdir.mkdir("tmpdir").join("tmp.png")) - mapdl.eplot( - background="w", - show_edges=True, - smooth_shading=True, - window_size=[1920, 1080], - savefig=filename, - ) - assert os.path.isfile(filename) - - def test_partial_mesh_nnum(mapdl, make_block): allsel_nnum_old = mapdl.mesh.nnum mapdl.nsel("S", "NODE", vmin=100, vmax=200) @@ -1451,14 +1348,6 @@ def test_mapdl_str(mapdl): assert "MAPDL Version" in out -def test_plot_empty_mesh(mapdl, cleared): - with pytest.warns(UserWarning): - mapdl.nplot(vtk=True) - - with pytest.warns(UserWarning): - mapdl.eplot(vtk=True) - - def test_equal_in_comments_and_title(mapdl): mapdl.com("=====") mapdl.title("This is = ") @@ -1933,17 +1822,6 @@ def test_igesin_whitespace(mapdl, cleared, tmpdir): assert int(n_ent[0]) > 0 -def test_cuadratic_beam(mapdl, cuadratic_beam_problem): - mapdl.post1() - mapdl.set(1) - assert ( - mapdl.post_processing.plot_nodal_displacement( - "NORM", line_width=10, render_lines_as_tubes=True, smooth_shading=True - ) - is None - ) - - @skip_if_not_local def test_save_on_exit(mapdl, cleared): mapdl2 = launch_mapdl( @@ -2058,53 +1936,6 @@ def test__flush_stored(mapdl): assert not mapdl._stored_commands -def test_download_file_with_vkt_false(mapdl, cube_solve, tmpdir): - # Testing basic behaviour - mapdl.eplot(vtk=False, savefig="myfile.png") - assert os.path.exists("myfile.png") - ti_m = os.path.getmtime("myfile.png") - - # Testing overwriting - mapdl.eplot(vtk=False, savefig="myfile.png") - assert not os.path.exists("myfile_1.png") - assert os.path.getmtime("myfile.png") != ti_m # file has been modified. - - os.remove("myfile.png") - - # Testing no extension - mapdl.eplot(vtk=False, savefig="myfile") - assert os.path.exists("myfile") - os.remove("myfile") - - # Testing update name when file exists. - mapdl.eplot(vtk=False, savefig=True) - assert os.path.exists("plot.png") - - mapdl.eplot(vtk=False, savefig=True) - assert os.path.exists("plot_1.png") - - os.remove("plot.png") - os.remove("plot_1.png") - - # Testing full path for downloading - plot_ = os.path.join(tmpdir, "myplot.png") - mapdl.eplot(vtk=False, savefig=plot_) - assert os.path.exists(plot_) - - plot_ = os.path.join(tmpdir, "myplot") - mapdl.eplot(vtk=False, savefig=plot_) - assert os.path.exists(plot_) - - -def test_plots_no_vtk(mapdl): - mapdl.kplot(vtk=False) - mapdl.lplot(vtk=False) - mapdl.aplot(vtk=False) - mapdl.vplot(vtk=False) - mapdl.nplot(vtk=False) - mapdl.eplot(vtk=False) - - def test_exited(mapdl): assert mapdl.exited == mapdl._exited assert isinstance(mapdl.exited, bool) diff --git a/tests/test_plotting.py b/tests/test_plotting.py index 9d2f88d15b..ab6199a04c 100644 --- a/tests/test_plotting.py +++ b/tests/test_plotting.py @@ -7,7 +7,6 @@ from ansys.mapdl.core.errors import ComponentDoesNotExits from ansys.mapdl.core.plotting import general_plotter -from conftest import skip_no_xserver @pytest.fixture @@ -37,23 +36,77 @@ def bc_example(mapdl, make_block): mapdl.nsel("all") -@skip_no_xserver -def test_kplot(cleared, mapdl, tmpdir): +def test_plot_empty_mesh(mapdl, cleared): + with pytest.warns(UserWarning): + mapdl.nplot(vtk=True) + + with pytest.warns(UserWarning): + mapdl.eplot(vtk=True) + + +def test_download_file_with_vkt_false(mapdl, cube_solve, tmpdir): + # Testing basic behaviour + mapdl.eplot(vtk=False, savefig="myfile.png") + assert os.path.exists("myfile.png") + ti_m = os.path.getmtime("myfile.png") + + # Testing overwriting + mapdl.eplot(vtk=False, savefig="myfile.png") + assert not os.path.exists("myfile_1.png") + assert os.path.getmtime("myfile.png") != ti_m # file has been modified. + + os.remove("myfile.png") + + # Testing no extension + mapdl.eplot(vtk=False, savefig="myfile") + assert os.path.exists("myfile") + os.remove("myfile") + + # Testing update name when file exists. + mapdl.eplot(vtk=False, savefig=True) + assert os.path.exists("plot.png") + + mapdl.eplot(vtk=False, savefig=True) + assert os.path.exists("plot_1.png") + + os.remove("plot.png") + os.remove("plot_1.png") + + # Testing full path for downloading + plot_ = os.path.join(tmpdir, "myplot.png") + mapdl.eplot(vtk=False, savefig=plot_) + assert os.path.exists(plot_) + + plot_ = os.path.join(tmpdir, "myplot") + mapdl.eplot(vtk=False, savefig=plot_) + assert os.path.exists(plot_) + + +def test_plots_no_vtk(mapdl): + mapdl.kplot(vtk=False) + mapdl.lplot(vtk=False) + mapdl.aplot(vtk=False) + mapdl.vplot(vtk=False) + mapdl.nplot(vtk=False) + mapdl.eplot(vtk=False) + + +@pytest.mark.parametrize("vtk", [True, False, None]) +def test_kplot(cleared, mapdl, tmpdir, vtk): mapdl.k("", 0, 0, 0) mapdl.k("", 1, 0, 0) mapdl.k("", 1, 1, 0) mapdl.k("", 0, 1, 0) filename = str(tmpdir.mkdir("tmpdir").join("tmp.png")) - cpos = mapdl.kplot(savefig=filename) + cpos = mapdl.kplot(vtk=vtk, savefig=filename) assert cpos is None - assert os.path.isfile(filename) - - mapdl.kplot(vtk=False) # make sure legacy still works + if vtk: + assert os.path.isfile(filename) -@skip_no_xserver -def test_lplot(cleared, mapdl, tmpdir): +@pytest.mark.parametrize("vtk", [True, False, None]) +def test_lplot(cleared, mapdl, tmpdir, vtk): k0 = mapdl.k("", 0, 0, 0) k1 = mapdl.k("", 1, 0, 0) k2 = mapdl.k("", 1, 1, 0) @@ -64,15 +117,14 @@ def test_lplot(cleared, mapdl, tmpdir): mapdl.l(k3, k0) filename = str(tmpdir.mkdir("tmpdir").join("tmp.png")) - cpos = mapdl.lplot(show_keypoint_numbering=True, savefig=filename) + cpos = mapdl.lplot(vtk=vtk, show_keypoint_numbering=True, savefig=filename) assert cpos is None - assert os.path.isfile(filename) + if vtk: + assert os.path.isfile(filename) - mapdl.lplot(vtk=False) # make sure legacy still works - -@skip_no_xserver -def test_aplot(cleared, mapdl): +@pytest.mark.parametrize("vtk", [True, False, None]) +def test_aplot(cleared, mapdl, vtk): k0 = mapdl.k("", 0, 0, 0) k1 = mapdl.k("", 1, 0, 0) k2 = mapdl.k("", 1, 1, 0) @@ -83,49 +135,37 @@ def test_aplot(cleared, mapdl): l3 = mapdl.l(k3, k0) mapdl.al(l0, l1, l2, l3) mapdl.aplot(show_area_numbering=True) - mapdl.aplot(color_areas=True, show_lines=True, show_line_numbering=True) + mapdl.aplot(vtk=vtk, color_areas=vtk, show_lines=True, show_line_numbering=True) mapdl.aplot(quality=100) mapdl.aplot(quality=-1) - # and legacy as well - mapdl.aplot(vtk=False) - -@skip_no_xserver -@pytest.mark.parametrize("vtk", [True, False]) +@pytest.mark.parametrize("vtk", [True, False, None]) def test_vplot(cleared, mapdl, vtk): mapdl.block(0, 1, 0, 1, 0, 1) mapdl.vplot(vtk=vtk, color_areas=True) -@skip_no_xserver -def test_nplot(cleared, mapdl): - mapdl.n(1, 0, 0, 0) - mapdl.n(11, 10, 0, 0) - mapdl.fill(1, 11, 9) - mapdl.nplot(vtk=False) - - @pytest.mark.parametrize("nnum", [True, False]) -@skip_no_xserver -def test_nplot_vtk(cleared, mapdl, nnum): +@pytest.mark.parametrize("vtk", [True, False, None]) +def test_nplot(cleared, mapdl, nnum, vtk): mapdl.n(1, 0, 0, 0) mapdl.n(11, 10, 0, 0) mapdl.fill(1, 11, 9) - mapdl.nplot(vtk=True, nnum=nnum, background="w", color="k") + mapdl.nplot(vtk=vtk, nnum=nnum, background="w", color="k") -@skip_no_xserver -def test_eplot(mapdl, make_block): +@pytest.mark.parametrize("vtk", [True, False, None]) +def test_eplot(mapdl, make_block, vtk): init_elem = mapdl.mesh.n_elem mapdl.aplot() # check aplot and verify it doesn't mess up the element plotting mapdl.eplot(show_node_numbering=True, background="w", color="b") + mapdl.eplot(vtk=vtk, show_node_numbering=True, background="w", color="b") mapdl.aplot() # check aplot and verify it doesn't mess up the element plotting assert mapdl.mesh.n_elem == init_elem -@skip_no_xserver def test_eplot_savefig(mapdl, make_block, tmpdir): filename = str(tmpdir.mkdir("tmpdir").join("tmp.png")) mapdl.eplot( @@ -138,13 +178,22 @@ def test_eplot_savefig(mapdl, make_block, tmpdir): assert os.path.isfile(filename) -@skip_no_xserver @pytest.mark.parametrize("return_plotter", [True, False]) @pytest.mark.parametrize("plot_bc_legend", [True, False]) @pytest.mark.parametrize("plot_bc_labels", [True, False]) def test_bc_plot_options( - mapdl, bc_example, return_plotter, plot_bc_legend, plot_bc_labels + mapdl, + bc_example, + verify_image_cache, + return_plotter, + plot_bc_legend, + plot_bc_labels, ): + if plot_bc_legend: + # The legend generates highly variance than other tests + # But it seems not always. + verify_image_cache.high_variance_test = True + p = mapdl.nplot( return_plotter=return_plotter, plot_bc=True, @@ -154,21 +203,22 @@ def test_bc_plot_options( if return_plotter: assert isinstance(p, Plotter) + p.show() else: assert p is None -@skip_no_xserver @pytest.mark.parametrize( - "bc_labels", + "bc_labels", # Added second part of the argument to avoid image cache name clashing. + # See https://github.com/pyvista/pytest-pyvista/issues/93 [ - "Mechanical", - "mechanical", - "meCHANICAL", - "ux", - "UX", - ["UX", "UY"], - "CSGZ", + ["Mechanical", "Title case"], + ["mechanical", "lower case"], + ["meCHANICAL", "Mixed case"], + ["ux", "Lower case"], + ["UX", "Upper case"], + [["UX", "UY"], "List of displacements"], + ["CSGZ", "Magnetic forces"], ], ) def test_bc_plot_bc_labels(mapdl, bc_example, bc_labels): @@ -176,12 +226,12 @@ def test_bc_plot_bc_labels(mapdl, bc_example, bc_labels): return_plotter=True, plot_bc=True, plot_bc_labels=True, - bc_labels=bc_labels, + bc_labels=bc_labels[0], ) - assert isinstance(p, Plotter) + assert isinstance(p, Plotter), bc_labels[1] + p.show() # plotting for catching -@skip_no_xserver @pytest.mark.parametrize( "bc_labels", [ @@ -191,7 +241,7 @@ def test_bc_plot_bc_labels(mapdl, bc_example, bc_labels): ) def test_bc_plot_bc_labels_error(mapdl, bc_example, bc_labels): with pytest.raises(ValueError): - p = mapdl.nplot( + mapdl.nplot( return_plotter=True, plot_bc=True, plot_bc_labels=True, @@ -199,12 +249,11 @@ def test_bc_plot_bc_labels_error(mapdl, bc_example, bc_labels): ) -@skip_no_xserver @pytest.mark.parametrize( "bc_target", [ - "Nodes", - "NOdes", + ["Nodes", "Title case"], + ["NOdes", "Mixed case"], ], ) def test_bc_plot_bc_target(mapdl, bc_example, bc_target): @@ -212,12 +261,12 @@ def test_bc_plot_bc_target(mapdl, bc_example, bc_target): return_plotter=True, plot_bc=True, plot_bc_labels=True, - bc_target=bc_target, + bc_target=bc_target[0], ) - assert isinstance(p, Plotter) + assert isinstance(p, Plotter), bc_target[1] + p.show() # plotting for catching -@skip_no_xserver @pytest.mark.parametrize( "bc_target", [ @@ -229,7 +278,7 @@ def test_bc_plot_bc_target(mapdl, bc_example, bc_target): ) def test_bc_plot_bc_target_error(mapdl, bc_example, bc_target): with pytest.raises(ValueError): - p = mapdl.nplot( + mapdl.nplot( return_plotter=True, plot_bc=True, plot_bc_labels=True, @@ -628,6 +677,7 @@ def test_plotter_input(mapdl, make_block): pl2 = mapdl.eplot(return_plotter=True, plotter=pl) assert pl == pl2 assert pl is pl2 + pl2.show() # plotting for catching # invalid plotter type with pytest.raises(TypeError): @@ -652,6 +702,7 @@ def test_show_bounds(mapdl, make_block): assert pl.bounds assert len(pl.bounds) == 6 assert pl.bounds != default_bounds + pl.show() # plotting for catching def test_background(mapdl, make_block): @@ -659,6 +710,7 @@ def test_background(mapdl, make_block): pl = mapdl.eplot(background="red", return_plotter=True) assert pl.background_color != default_color assert pl.background_color == "red" + pl.show() # plotting for catching def test_plot_nodal_values(mapdl, make_block): @@ -687,10 +739,9 @@ def test_vsel_iterable(mapdl, make_block): def test_color_areas(mapdl, make_block): - mapdl.aplot(vtk=True, color_areas=True, return_plotter=True) + mapdl.aplot(vtk=True, color_areas=True) -@skip_no_xserver @pytest.mark.parametrize( "color_areas", [ @@ -708,11 +759,8 @@ def test_color_areas(mapdl, make_block): ], ) def test_color_areas_individual(mapdl, make_block, color_areas): - pl = mapdl.aplot(vtk=True, color_areas=color_areas, return_plotter=True) - colors = [ - value.prop.color.hex_rgba for key, value in pl.actors.items() if "Grid" in key - ] - assert len(np.unique(colors, axis=0)) == mapdl.geometry.n_area + # we do rely on the `pytest-pyvista` extension to deal with the differences + mapdl.aplot(vtk=True, color_areas=color_areas) def test_color_areas_error(mapdl, make_block): @@ -773,7 +821,7 @@ def test_file_type_for_plots(mapdl): def test_cmplot_individual(mapdl, make_block, entity): mapdl.allsel() mapdl.cm("tmp_cm", entity=entity) - pl = mapdl.cmplot("tmp_cm", return_plotter=True) + mapdl.cmplot("tmp_cm") @pytest.mark.parametrize("label", ["N", "P"]) @@ -819,3 +867,15 @@ def test_cmplot_all(mapdl, make_block, entity): pl = mapdl.cmplot("all", entity, return_plotter=True) assert np.allclose(pl.mesh.points, ent[ids - 1]) + pl.show() + + +def test_cuadratic_beam(mapdl, cuadratic_beam_problem): + mapdl.post1() + mapdl.set(1) + assert ( + mapdl.post_processing.plot_nodal_displacement( + "NORM", line_width=10, render_lines_as_tubes=True, smooth_shading=True + ) + is None + ) diff --git a/tests/test_post.py b/tests/test_post.py index 59d5021741..2edd736220 100644 --- a/tests/test_post.py +++ b/tests/test_post.py @@ -73,9 +73,6 @@ def static_solve(mapdl): mapdl.amesh("all") mapdl.prep7() - # plot elements - # mapdl.eplot() - # Apply tangential pressure mapdl.esel("S", "TYPE", "", 2) mapdl.sfe("all", 2, "pres", "", pressure) @@ -745,6 +742,7 @@ def test_general_plotter_returns(mapdl, static_solve, verify_image_cache): verify_image_cache.skip = True # skipping image verification # Returns + assert ( mapdl.post_processing.plot_nodal_displacement("X", smooth_shading=True) is None ) @@ -754,12 +752,12 @@ def test_general_plotter_returns(mapdl, static_solve, verify_image_cache): ), CameraPosition, ) - assert isinstance( - mapdl.post_processing.plot_nodal_displacement( - "X", smooth_shading=True, return_plotter=True - ), - Plotter, + + p = mapdl.post_processing.plot_nodal_displacement( + "X", smooth_shading=True, return_plotter=True ) + assert isinstance(p, Plotter) + p.show() with pytest.raises(ValueError): mapdl.post_processing.plot_nodal_displacement( @@ -787,16 +785,15 @@ def test_general_plotter_returns(mapdl, static_solve, verify_image_cache): ), CameraPosition, ) - assert isinstance( - mapdl.post_processing.plot_nodal_displacement( - "X", - smooth_shading=True, - savefig=True, - return_cpos=False, - return_plotter=True, - ), - Plotter, + + p = mapdl.post_processing.plot_nodal_displacement( + "X", + smooth_shading=True, + savefig=True, + return_cpos=False, + return_plotter=True, ) + assert isinstance(p, Plotter) def test_time_frequency_values(mapdl, contact_solve): @@ -859,6 +856,20 @@ def test_meta_post_plot_docstrings(): ), f"Less than three complete one-liner general plotter link in {meth.__name__}" +def test_cuadratic_beam(mapdl, cuadratic_beam_problem): + # Display elements with their nodes numbers. + mapdl.eplot(show_node_numbering=True, line_width=5, cpos="xy", font_size=40) + + mapdl.post1() + mapdl.set(1) + assert ( + mapdl.post_processing.plot_nodal_displacement( + "NORM", line_width=10, render_lines_as_tubes=True, smooth_shading=True + ) + is None + ) + + ############################################################################### # @pytest.mark.parametrize('comp', COMPONENT_STRESS_TYPE) # def test_nodal_thermal_component_strain(mapdl, thermal_solve, comp):