-
Notifications
You must be signed in to change notification settings - Fork 132
Adding unit testing section #1621
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
34fe10e
Adding unit testing section
clatapie e60ac33
Merge branch 'main' into doc/adding-unit-testing-informations
clatapie af2f738
Apply suggestions from code review
clatapie 87e8288
Merge branch 'doc/adding-unit-testing-informations' of https://github…
clatapie 35a7be9
Mention of integration tests and CI/CD
clatapie 79a1b20
Adding pytests examples
clatapie 03a3827
Update doc/source/contribution_and_api/unit_testing.rst
clatapie 1af5908
Apply suggestions from code review
clatapie 5747d7f
Apply suggestions from code review
clatapie 666f1fb
Apply suggestions from code review
clatapie e37a7dc
Apply suggestions from code review
clatapie a8db9a1
Formatting of the code
clatapie 3883349
Apply suggestions from code review
clatapie 0c2501e
Apply suggestions from code review
clatapie da38fb9
Update doc/source/contribution_and_api/unit_testing.rst
clatapie 35ff739
Apply suggestions from code review
clatapie 6d23a75
Changing titles
clatapie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,3 +137,4 @@ MAPDL commands mapped to PyMAPDL, see :ref:`ref_mapdl_commands`. | |
post | ||
solution | ||
xpl | ||
unit_testing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
.. _ref_unit_testing_contributing: | ||
|
||
Unit Testing | ||
=============== | ||
|
||
Unit testing is highly important. It enables to check that the | ||
changes on the code are efficient and don't have an impact on | ||
other parts of the code. | ||
clatapie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Unit tests are in the ``tests`` directory inside this repository. | ||
clatapie marked this conversation as resolved.
Show resolved
Hide resolved
clatapie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Test Validation GitHub workflow | ||
clatapie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
------------------------------- | ||
clatapie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
`Codecov <https://github.com/codecov>`_ generates a coverage report of | ||
the committed code. It details how merging the Pull Request will impact the | ||
coverage. It is one of the checks that must be approved to | ||
merge the code. | ||
clatapie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Creating a unit test | ||
-------------------- | ||
clatapie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
In the pymapdl repository, the tests are done with the **pytest package**. | ||
clatapie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
To create a pytest file, its name must be one of the following forms: | ||
``filename_test.py`` or ``test_filename.py``. | ||
clatapie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
To create tests, please take note of the `pytest documentation <https://docs.pytest.org/en/7.2.x/>`_ . | ||
germa89 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
The `unit test <https://github.com/pyansys/pymapdl/blob/main/tests/test_math.py>`_ of the | ||
**ansys.mapdl.core.math** library is one of the numerous unit tests that you can find in | ||
the `test directory <https://github.com/pyansys/pymapdl/tree/main/tests>`_ . | ||
You'll find examples to understand how you can use the pytest package. | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
clatapie marked this conversation as resolved.
Show resolved
Hide resolved
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.