-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into release/0.9
- Loading branch information
Showing
126 changed files
with
2,814 additions
and
1,417 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -27,10 +27,15 @@ | |
PyAEDT is a Python library that interacts directly with the API for | ||
Ansys Electronics Desktop (AEDT) to make scripting simpler. The architecture | ||
for PyAEDT can be reused for all AEDT 3D products (HFSS, Icepak, Maxwell 3D, | ||
and Q3D Extractor), 2D tools, and Ansys Mechanical. PyAEDT also provides | ||
and Q3D Extractor), 2D tools, and Ansys Mechanical inside AEDT. PyAEDT also provides | ||
support for circuit tools like Nexxim and system simulation tools like | ||
Twin Builder. Finally, PyAEDT provides scripting capabilities in Ansys layout | ||
tools like HFSS 3D Layout and EDB. The PyAEDT class and method structures | ||
tools like HFSS 3D Layout. The Ansys Electronics Database | ||
([EDB](https://edb.docs.pyansys.com/version/stable/)) is included | ||
with PyAEDT as a dependency and is recommended for any automated manipulation and | ||
setup of layout data for PCBs, electronic packages, and integrated circuits. | ||
|
||
The PyAEDT class and method structures | ||
simplify operation while reusing information as much as possible across | ||
the API. | ||
|
||
|
@@ -130,6 +135,31 @@ To reach the project support team, email [[email protected]](mailto:pyansys | |
To run PyAEDT, you must have a local licenced copy of AEDT. | ||
PyAEDT supports AEDT versions 2022 R1 or newer. | ||
|
||
## Contributing | ||
|
||
For comprehensive information on contributing to the PyAnsys project, see the [PyAnsys developer's guide](https://dev.docs.pyansys.com). | ||
|
||
|
||
Note that PyAEDT uses semantic naming for pull requests (PR). This convention | ||
greatly simplifies the review process by providing meaningful | ||
information in the PR title. The | ||
following | ||
[prefixes](https://github.com/ansys/actions/blob/main/commit-style/action.yml) | ||
should be used for pull request name: | ||
|
||
- "BUILD" | ||
- "CHORE" | ||
- "CI" | ||
- "DOCS" | ||
- "FEAT" | ||
- "FIX" | ||
- "PERF" | ||
- "REFACTOR" | ||
- "REVERT" | ||
- "STYLE" | ||
- "TEST" | ||
|
||
|
||
## Student version | ||
|
||
PyAEDT supports AEDT Student versions 2022 R1 and later. For more information, see the | ||
|
This file contains 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,30 @@ | ||
<!-- | ||
Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. | ||
SPDX-License-Identifier: MIT | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
--> | ||
|
||
# Security Policy | ||
|
||
## Reporting a Vulnerability | ||
|
||
If you detect a vulnerability, contact the [PyAnsys Core team](mailto:[email protected]) | ||
mentioning the repository and the details of your finding. The team will address it as soon as possible. |
Binary file not shown.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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,72 @@ | ||
"""Test utility functions of PyAEDT. | ||
""" | ||
|
||
import logging | ||
from unittest.mock import MagicMock | ||
from unittest.mock import patch | ||
|
||
import pytest | ||
|
||
from pyaedt import settings | ||
from pyaedt.generic.general_methods import pyaedt_function_handler | ||
|
||
SETTINGS_RELEASE_ON_EXCEPTION = settings.release_on_exception | ||
SETTINGS_ENABLE_ERROR_HANDLER = settings.enable_error_handler | ||
ERROR_MESSAGE = "Dummy message." | ||
|
||
|
||
@pyaedt_function_handler(deprecated_arg="trigger_exception") | ||
def foo(trigger_exception=True): | ||
"""Some dummy function used for testing.""" | ||
if trigger_exception: | ||
raise Exception(ERROR_MESSAGE) | ||
|
||
|
||
@patch("pyaedt.generic.desktop_sessions._desktop_sessions") | ||
def test_handler_release_on_exception(mock_sessions): | ||
"""Test handler while activating or deactivating error handler.""" | ||
mock_session = MagicMock() | ||
mock_sessions.values.return_value = [mock_session] | ||
settings.enable_error_handler = True | ||
settings.release_on_exception = True | ||
|
||
# Check that release desktop is called once | ||
foo() | ||
assert mock_session.release_desktop.assert_called_once | ||
|
||
# Check that release desktop is not called | ||
settings.release_on_exception = False | ||
foo() | ||
assert mock_session.release_desktop.assert_called | ||
|
||
# Teardown | ||
settings.enable_error_handler = SETTINGS_ENABLE_ERROR_HANDLER | ||
settings.release_on_exception = SETTINGS_RELEASE_ON_EXCEPTION | ||
|
||
|
||
def test_handler_enable_error_handler(): | ||
"""Test handler while activating/deactivating error handler.""" | ||
settings.enable_error_handler = True | ||
assert foo() == False | ||
|
||
settings.enable_error_handler = False | ||
with pytest.raises(Exception) as exec_info: | ||
foo() | ||
assert str(exec_info.value) == ERROR_MESSAGE | ||
|
||
# Teardown | ||
settings.enable_error_handler = SETTINGS_ENABLE_ERROR_HANDLER | ||
|
||
|
||
def test_handler_deprecation_log_warning(caplog): | ||
"""Test handler deprecation argument mechanism.""" | ||
EXPECTED_ARGUMENT = "Argument `deprecated_arg` is deprecated for method `foo`; use `trigger_exception` instead." | ||
|
||
with caplog.at_level(logging.WARNING, logger="Global"): | ||
foo(deprecated_arg=False) | ||
assert len(caplog.records) == 1 | ||
assert "WARNING" == caplog.records[0].levelname | ||
assert EXPECTED_ARGUMENT == caplog.records[0].message | ||
|
||
foo(trigger_exception=False) | ||
assert len(caplog.records) == 1 |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.