Skip to content

Commit 6427460

Browse files
germa89pyansys-ci-botCopilot
authored
docs: fix typos and improve testing documentation (#4273)
* docs: fix typos and improve testing documentation - Fix multiple typos in MAPDL documentation (madpl -> mapdl) - Improve testing documentation with environment variables table - Add DMP and SMP terms to dictionary - Minor code comment fixes * chore: adding changelog file 4273.documentation.md [dependabot-skip] * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: pyansys-ci-bot <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent a35c784 commit 6427460

File tree

9 files changed

+86
-61
lines changed

9 files changed

+86
-61
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix typos and improve testing documentation

doc/source/getting_started/develop_pymapdl.rst

Lines changed: 73 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ guidelines for developing code in a repository:
147147
continuous integration/continuous deployment (CI/CD) pipelines to catch issues early
148148
and ensure reliable deployments. For more information, see `Unit testing`_.
149149

150+
.. note:: No pull request is accepted if the amount of test coverage is not sufficient.
151+
If you are adding new code, ensure that it is covered by existing or new unit tests.
152+
150153
#. **Respect code style and standards**: Follow code style
151154
guidelines and adhere to coding standards specific to your language or
152155
framework.
@@ -228,38 +231,6 @@ along with integration tests. The difference between a unit test and an
228231
integration test is that the latter tests several units of the code to ensure
229232
that they all work together.
230233

231-
To run all the unit tests use the following command:
232-
233-
.. code:: console
234-
235-
(.venv) mapdl@machine:~/pymapdl$ pytest
236-
237-
If you are running on a **Linux machine without display**, you must install ``xvfb`` OS
238-
library and run the preceding command with the ``xvfb-run`` command as prefix.
239-
240-
.. code:: console
241-
242-
(.venv) mapdl@machine:~/pymapdl$ xvfb-run pytest
243-
244-
In case you want to run only a certain subset of tests, you can use the ``-k`` argument
245-
to filter the tests using booleans:
246-
247-
.. code:: console
248-
249-
(.venv) mapdl@machine:~/pymapdl$ pytest -k "test_nlist_to_array or test_string_with_literal"
250-
==================================================== test session starts ====================================================
251-
platform darwin -- Python 3.10.13, pytest-7.4.3, pluggy-1.3.0
252-
rootdir: /Users/german.ayuso/pymapdl
253-
configfile: pyproject.toml
254-
testpaths: tests
255-
plugins: timeout-2.2.0, cov-4.1.0, sphinx-0.5.0, rerunfailures-13.0, anyio-4.1.0, pytest_pyvista-0.1.9
256-
collected 1468 items / 1466 deselected / 4 skipped / 2 selected
257-
258-
tests/test_commands.py .. [100%]
259-
260-
=============================================== PyMAPDL Pytest short summary ================================================
261-
======================================= 2 passed, 4 skipped, 1466 deselected in 2.27s =======================================
262-
263234

264235
Creation of a unit test
265236
-----------------------
@@ -297,34 +268,85 @@ It is executed upstream of each test and not within all tests.
297268
298269
Passing the ``cleared`` fixture is also useful since it clears up the MAPDL database
299270
and configuration before performing the test.
300-
If you do not have MAPDL installed locally but still want to run the
301-
unit testing, you must set up the following environment variables.
302271

303-
.. tab-set::
272+
Running PyMAPDL tests
273+
---------------------
274+
275+
To run all the unit tests use the following command:
276+
277+
.. code:: console
278+
279+
(.venv) mapdl@machine:~/pymapdl$ pytest
280+
281+
If you just want to run a specific test file, you can provide the path to the file:
282+
283+
.. code:: console
284+
285+
(.venv) mapdl@machine:~/pymapdl$ pytest tests/test_commands.py
286+
287+
In case you want to run only a certain subset of tests, you can use the ``-k`` argument
288+
to filter the tests using booleans:
289+
290+
.. code:: console
304291
305-
.. tab-item:: Windows
306-
:sync: key1
292+
(.venv) mapdl@machine:~/pymapdl$ pytest -k "test_nlist_to_array or test_string_with_literal"
293+
======================================= test session starts ====================================================
294+
platform darwin -- Python 3.10.13, pytest-7.4.3, pluggy-1.3.0
295+
rootdir: /Users/german.ayuso/pymapdl
296+
configfile: pyproject.toml
297+
testpaths: tests
298+
plugins: timeout-2.2.0, cov-4.1.0, sphinx-0.5.0, rerunfailures-13.0, anyio-4.1.0, pytest_pyvista-0.1.9
299+
collected 1468 items / 1466 deselected / 4 skipped / 2 selected
307300
308-
.. code:: pwsh-session
301+
tests/test_commands.py .. [100%]
309302
310-
SET PYMAPDL_START_INSTANCE=False
311-
SET PYMAPDL_PORT=<MAPDL Port> (default 50052)
312-
SET PYMAPDL_IP=<MAPDL IP> (default 127.0.0.1)
303+
================================= PyMAPDL Pytest short summary ================================================
304+
========================= 2 passed, 4 skipped, 1466 deselected in 2.27s =======================================
313305
314-
.. tab-item:: Linux
315-
:sync: key1
316-
317-
.. code:: console
306+
If you are running on a **Linux machine without display** (for example running from
307+
a container), you must install ``xvfb`` OS library and run the preceding command with the ``xvfb-run`` command as prefix.
318308

319-
export PYMAPDL_START_INSTANCE=False
320-
export PYMAPDL_PORT=<MAPDL Port> (default 50052)
321-
export PYMAPDL_IP=<MAPDL IP> (default 127.0.0.1)
309+
.. code:: console
322310
311+
(.venv) mapdl@machine:~/pymapdl$ xvfb-run pytest
323312
324-
These environment variables tell PyMAPDL to attempt to connect to the existing
325-
MAPDL service by default when the ``launch_mapdl`` function is used.
326313
327-
Additionally, you can use the :envvar:`PYMAPDL_MAPDL_EXEC` and :envvar:`PYMAPDL_MAPDL_VERSION`
314+
Configuring the test suite
315+
--------------------------
316+
317+
PyMAPDL can operate in multiple situations, or configurations.
318+
To test these different configurations, you can use the `pytest` framework with specific environment variables.
319+
320+
The list of environment variables that can be set includes:
321+
322+
+-----------------------------------+------------------+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
323+
| Environment variable | Values | Default | Usage |
324+
+===================================+==================+=================+===============================================================================================================================================================================================================================================================+
325+
| :envvar:`ON_CI` | `True`/`False` | `False` | Tell Pytest it is running on GitHub Actions |
326+
+-----------------------------------+------------------+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
327+
| :envvar:`ON_LOCAL` | `True`/`False` | Detected | Tell Pytest that PyMAPDL is running on local, and the test should match that. The default is to detect whether MAPDL is installed or not. If the environment variable :envvar:`PYMAPDL_START_INSTANCE` is set, then :envvar:`ON_LOCAL` is `False`. |
328+
+-----------------------------------+------------------+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
329+
| :envvar:`ON_UBUNTU` | `True`/`False` | Detected | Tell Pytest that PyMAPDL is running on Ubuntu, and the test should match that. |
330+
+-----------------------------------+------------------+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
331+
| :envvar:`ON_STUDENT` | `True`/`False` | `False` | Tell Pytest that PyMAPDL is running on a student environment, and the test should match that. |
332+
+-----------------------------------+------------------+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
333+
| :envvar:`TESTING_MINIMAL` | `True`/`False` | `False` | Tell Pytest that PyMAPDL is installed with the minimal requirements, hence it won't run tests that requires libraries like Pyvista, DPF, etc. |
334+
+-----------------------------------+------------------+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
335+
| :envvar:`PYMAPDL_DEBUG_TESTING` | `True`/`False` | `False` | Tell PyMAPDL to enable debug while testing. This means that the APDL commands are recorded to the file `pymapdl.apdl` and the debug calls are logged into the file `pymapdl.log`. |
336+
+-----------------------------------+------------------+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
337+
| :envvar:`HAS_GRPC` | `True`/`False` | Detected | Tell PyMAPDL that the gRPC interface is available for testing. If `TESTING_MINIMAL` is `True`, then this is `True` by default. |
338+
+-----------------------------------+------------------+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
339+
| :envvar:`HAS_DPF` | `True`/`False` | `False` | Tell Pytest that DPF should be tested. |
340+
+-----------------------------------+------------------+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
341+
| :envvar:`DISTRIBUTED_MODE` | `SMP`/`DMP` | `SMP` | Tell Pytest that MAPDL is running a given distributed mode. |
342+
+-----------------------------------+------------------+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
343+
| :envvar:`SUPPORT_PLOTTING` | `True`/`False` | Detected | Tell Pytest that the machine supports plotting (it has a display). |
344+
+-----------------------------------+------------------+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
345+
| :envvar:`TEST_DPF_BACKEND` | `Yes`/`No` | `NO` | Tell Pytest that the module `Result` with DPF backend should be tested. |
346+
+-----------------------------------+------------------+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
347+
348+
Additionally, you can use any :ref:`ref_environment_variables`
349+
like the :envvar:`PYMAPDL_MAPDL_EXEC` and :envvar:`PYMAPDL_MAPDL_VERSION`
328350
environment variables to specify the MAPDL executable path and the version to launch (if
329351
multiple versions of MAPDL are installed).
330352

doc/source/getting_started/docker.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ you can use the following command to launch MAPDL:
261261
Connect to the MAPDL container from Python
262262
==========================================
263263

264-
You can connect to an MAPDL instance as indicated in :ref:`connect_grpc_madpl_session`.
264+
You can connect to an MAPDL instance as indicated in :ref:`connect_grpc_mapdl_session`.
265265
You do not need to specify an IP address because Docker maps the ports to the local host.
266266

267267

doc/source/getting_started/launcher.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Connect PyMAPDL to a local MAPDL instance
4848
Connect to a local MAPDL instance requires two steps: launching a
4949
local MAPDL session and connect to it.
5050

51-
.. _launch_grpc_madpl_session:
51+
.. _launch_grpc_mapdl_session:
5252

5353
Launch a local gRPC MAPDL session
5454
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -115,7 +115,7 @@ From version v0.68, you can use a command line interface to launch, stop, and li
115115
local MAPDL instances.
116116
For more information, see :ref:`ref_cli`.
117117

118-
.. _connect_grpc_madpl_session:
118+
.. _connect_grpc_mapdl_session:
119119

120120
Connect to the local MAPDL instance
121121
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -143,7 +143,7 @@ Just make sure that you specify the mapped port instead of the internal MAPDL po
143143
For more information, see :ref:`pymapdl_docker`.
144144

145145

146-
.. _connect_grpc_remote_madpl_session:
146+
.. _connect_grpc_remote_mapdl_session:
147147

148148
Connect PyMAPDL to a remote MAPDL instance
149149
------------------------------------------

doc/source/getting_started/macos.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ MAPDL is not compatible with a MacOS.
2121
There are two options:
2222

2323
* **Connect to a remote instance**: You can connect to a remote instance running
24-
on a Windows or Linux machine as indicated in :ref:`connect_grpc_madpl_session`.
24+
on a Windows or Linux machine as indicated in :ref:`connect_grpc_mapdl_session`.
2525

2626
* **Launch MAPDL locally using Docker**: You can run MAPDL on a MacOS machine as
2727
indicated in :ref:`launch_mapdl_on_macos`.
@@ -64,6 +64,6 @@ as shown in this code example:
6464
Connect to an MAPDL container
6565
=============================
6666

67-
You can connect to an MAPDL instance as indicated in :ref:`connect_grpc_madpl_session`.
67+
You can connect to an MAPDL instance as indicated in :ref:`connect_grpc_mapdl_session`.
6868

6969

doc/source/user_guide/troubleshoot.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ In such cases, if you try to start MAPDL from the command line you might see an
273273
FlexNet Licensing error:-5,357
274274
275275
276-
If there are not enough licenses available, you might see an error similar to the above one.
276+
This means that there are not enough licenses available to start MAPDL.
277277
In these cases you should contact your Ansys license administrator at your organization.
278278

279279
If you are responsible for maintaining Ansys licensing or have a personal installation of Ansys, see the online
@@ -803,7 +803,7 @@ Recommendations
803803

804804
When connecting to an instance of MAPDL using gRPC (default), there are some cases
805805
where the MAPDL server might exit unexpectedly. There
806-
are several ways to improve MADPL performance and stability:
806+
are several ways to improve MAPDL performance and stability:
807807

808808
Use ``mute`` to improve stability
809809
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

doc/styles/config/vocabularies/ANSYS/accept.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ devcontainer
6363
DevContainer
6464
Dimitris
6565
discretisation
66+
DMP
6667
dof
6768
ect
6869
eigenfrequency
@@ -162,6 +163,7 @@ singl
162163
Slurm
163164
SLURM
164165
smal
166+
SMP
165167
sord
166168
spotweld
167169
squeue

src/ansys/mapdl/core/database/database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def stop(self):
318318

319319
def _status(self):
320320
"""
321-
Return the status of the MADPL DB Server.
321+
Return the status of the MAPDL DB Server.
322322
323323
Examples
324324
--------

src/ansys/mapdl/core/mapdl_extended.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3310,7 +3310,7 @@ def get_value(
33103310
33113311
This method uses :func:`Mapdl.get`.
33123312
3313-
See the full MADPL command documentation at `*GET
3313+
See the full MAPDL command documentation at `*GET
33143314
<https://www.mm.bme.hu/~gyebro/files/ans_help_v182/ans_cmd/Hlp_C_GET.html>`_
33153315
33163316
.. note::

0 commit comments

Comments
 (0)