Skip to content

Updated CICD to 22R2 #1310

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 11 commits into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ironpython.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v2

- name: 'Run Unit Tests in Ironpython'
timeout-minutes: 40
timeout-minutes: 45
run: |
$process = start-process 'cmd' -ArgumentList '/c .\_unittest_ironpython\run_unittests_batchmode.cmd' -PassThru

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ironpython_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run: |
export DISPLAY="127.0.0.1:1"
chmod 777 _unittest_ironpython/run_unittests_batchmode_linux.cmd
timeout -k 2400s 2400s ./_unittest_ironpython/run_unittests_batchmode_linux.cmd
timeout -k 3600s 3600s ./_unittest_ironpython/run_unittests_batchmode_linux.cmd
if [ $? -eq 124 ] ; then
echo "ERROR: Timeout while waiting for the file _unittest_ironpython/tests_succeeded.log."
exit 1
Expand Down
2 changes: 1 addition & 1 deletion _unittest/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
with open(local_config_file) as f:
config = json.load(f)
else:
default_version = "2022.1"
default_version = "2022.2"
if inside_desktop and "oDesktop" in dir(sys.modules["__main__"]):
default_version = sys.modules["__main__"].oDesktop.GetVersion()[0:6]
config = {
Expand Down
5 changes: 3 additions & 2 deletions _unittest/test_00_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@

test_project_name = "Coax_HFSS"

if not is_ironpython and config["desktopVersion"] >= "2022.2":
if not is_ironpython and config["desktopVersion"] >= "2023.1":

class TestClass(BasisTest, object):
def setup_class(self):
settings.use_grpc_api = True

def teardown_class(self):
settings.use_grpc_api = config["use_grpc"]
settings.non_graphical = config["NonGraphical"]

def test_00_destkop(self):
d = Desktop(specified_version="2022.2", new_desktop_session=True)
Expand All @@ -33,7 +34,7 @@ def test_01_destkop_existing(self):
d.release_desktop(False, False)

def test_02_destkop_new(self):
d = Desktop(specified_version="2022.2", new_desktop_session=True)
d = Desktop(specified_version="2022.2", new_desktop_session=True, non_graphical=True)
assert d.port in grpc_active_sessions()
d.release_desktop(False, False)

Expand Down
3 changes: 1 addition & 2 deletions _unittest/test_02_2D_modeler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import os

from _unittest.conftest import BasisTest
from _unittest.conftest import config
from pyaedt.generic.general_methods import is_ironpython
from pyaedt.generic.general_methods import isclose
from pyaedt.maxwell import Maxwell2d
Expand Down Expand Up @@ -129,7 +128,7 @@ def test_08_create_regular_polygon(self):
assert pg2.material_name == "copper"
assert isclose(pg2.faces[0].area, 5.196152422706631)

@pytest.mark.skipif(config["NonGraphical"] or is_ironpython, reason="Not running in ironpython")
@pytest.mark.skipif(is_ironpython, reason="Not running in ironpython")
def test_09_plot(self):
self.aedtapp.modeler.create_regular_polygon([0, 0, 0], [0, 0, 2])
self.aedtapp.modeler.create_regular_polygon(
Expand Down
10 changes: 5 additions & 5 deletions _unittest/test_12_PostProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,18 +416,18 @@ def test_09d_create_monitor(self): # pragma: no cover
assert new_report.add_cartesian_y_marker("-55")

@pytest.mark.skipif(
config["NonGraphical"], reason="Skipped because it cannot run on build machine in non-graphical mode"
config["desktopVersion"] < "2022.2",
reason="Skipped because it cannot run on build machine in non-graphical mode",
)
def test_09e_add_line_from_point(self): # pragma: no cover
assert self.aedtapp.post.create_report("dB(S(1,1))")
new_report = self.aedtapp.post.reports_by_category.modal_solution("dB(S(1,1))")
assert new_report.create()
assert new_report.add_limit_line_from_points([3, 5, 5, 3], [-50, -50, -60, -60], "GHz")

@pytest.mark.skipif(
config["desktopVersion"] < "2022.2", reason="Not working in non-graphical mode in version earlier than 2022.2."
)
def test_09f_add_line_from_equation(self):
assert self.aedtapp.post.create_report("dB(S(1,1))")
new_report = self.aedtapp.post.reports_by_category.modal_solution("dB(S(1,1))")
assert new_report.create()
assert new_report.add_limit_line_from_equation(start_x=1, stop_x=20, step=0.5, units="GHz")
Expand Down Expand Up @@ -862,13 +862,13 @@ def test_66_spectral_from_json(self):
local_path = os.path.dirname(os.path.realpath(__file__))
self.circuit_test.analyze_setup("Transient")
assert self.circuit_test.post.create_report_from_configuration(
os.path.join(local_path, "example_models", "report_json", "Spectral_Report_simple.json"),
os.path.join(local_path, "example_models", "report_json", "Spectral_Report_Simple.json"),
solution_name="Transient",
)

def test_67_sweep_from_json(self):
local_path = os.path.dirname(os.path.realpath(__file__))
dict_vals = json_to_dict(os.path.join(local_path, "example_models", "report_json", "Modal_Report_simple.json"))
dict_vals = json_to_dict(os.path.join(local_path, "example_models", "report_json", "Modal_Report_Simple.json"))
assert self.aedtapp.post.create_report_from_configuration(input_dict=dict_vals)

@pytest.mark.skipif(
Expand Down
5 changes: 3 additions & 2 deletions _unittest/test_20_HFSS.py
Original file line number Diff line number Diff line change
Expand Up @@ -949,10 +949,11 @@ def test_50_set_differential_pair(self):
hfss2.close_project()

@pytest.mark.skipif(
config["desktopVersion"] < "2022.2", reason="Not working in non-graphical in version lower than 2022.2"
is_ironpython or config["desktopVersion"] < "2022.2",
reason="Not working in non-graphical in version lower than 2022.2",
)
def test_51_array(self):
self.aedtapp.insert_design("Array_simple")
self.aedtapp.insert_design("Array_simple", "Modal")
from pyaedt.generic.DataHandlers import json_to_dict

dict_in = json_to_dict(os.path.join(local_path, "example_models", "array_simple.json"))
Expand Down
19 changes: 13 additions & 6 deletions _unittest/test_26_emit.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Import required modules
from _unittest.conftest import BasisTest
from _unittest.conftest import config
from _unittest.conftest import is_ironpython
from pyaedt import Emit
from pyaedt.modeler.PrimitivesEmit import EmitComponent
from pyaedt.modeler.PrimitivesEmit import EmitComponents
Expand All @@ -27,7 +28,9 @@ def test_objects(self):
assert self.aedtapp.modeler
assert self.aedtapp.oanalysis is None

@pytest.mark.skipif(config["NonGraphical"], reason="Not functional in non-graphical mode")
@pytest.mark.skipif(
config["desktopVersion"] <= "2022.1" or is_ironpython, reason="Skipped on versions lower than 2021.2"
)
def test_create_components(self):
radio = self.aedtapp.modeler.components.create_component("New Radio", "TestRadio")
assert radio.name == "TestRadio"
Expand All @@ -36,8 +39,9 @@ def test_create_components(self):
assert antenna.name == "TestAntenna"
assert isinstance(antenna, EmitComponent)

@pytest.mark.skipif(config["NonGraphical"], reason="Not functional in non-graphical mode")
@pytest.mark.skipif(config["desktopVersion"] < "2021.2", reason="Skipped on versions lower than 2021.2")
@pytest.mark.skipif(
config["desktopVersion"] <= "2022.1" or is_ironpython, reason="Skipped on versions lower than 2021.2"
)
def test_connect_components(self):
radio = self.aedtapp.modeler.components.create_component("New Radio")
antenna = self.aedtapp.modeler.components.create_component("Antenna")
Expand All @@ -54,7 +58,9 @@ def test_connect_components(self):
assert connected_comp is None
assert connected_port is None

@pytest.mark.skipif(config["NonGraphical"], reason="Not functional in non-graphical mode")
@pytest.mark.skipif(
config["desktopVersion"] <= "2022.1" or is_ironpython, reason="Skipped on versions lower than 2021.2"
)
def test_radio_component(self):
radio = self.aedtapp.modeler.components.create_component("New Radio")
# default radio has 1 Tx channel and 1 Rx channel
Expand All @@ -67,8 +73,9 @@ def test_radio_component(self):
band.enabled = False
assert not band.enabled

@pytest.mark.skipif(config["NonGraphical"], reason="Not functional in non-graphical mode")
@pytest.mark.skipif(config["desktopVersion"] < "2021.2", reason="Skipped on versions lower than 2021.2")
@pytest.mark.skipif(
config["desktopVersion"] <= "2022.1" or is_ironpython, reason="Skipped on versions lower than 2021.2"
)
def test_couplings(self):
self.aedtapp = BasisTest.add_app(self, project_name="Cell Phone RFI Desense", application=Emit)
links = self.aedtapp.couplings.linkable_design_names
Expand Down
2 changes: 1 addition & 1 deletion _unittest/test_41_3dlayout_modeler.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ def test_36_import_gds(self):
assert self.aedtapp.import_gds(gds_file, aedb_path=aedb_file, control_file=control_file)
assert self.aedtapp.import_gds(gds_file, aedb_path=aedb_file, control_file=control_file)

@pytest.mark.skipif(os.name == "posix", reason="Failing on linux")
def test_37_import_gerber(self):
gerber_file = os.path.join(local_path, "example_models", "cad", "Gerber", "gerber1.zip")
control_file = os.path.join(local_path, "example_models", "cad", "Gerber", "gerber1.xml")
Expand All @@ -501,7 +502,6 @@ def test_39_import_ipc(self):
@pytest.mark.skipif(config["desktopVersion"] < "2022.2", reason="Not working on AEDT 22R1")
def test_40_test_flex(self):
assert self.flex.enable_rigid_flex()
assert not self.flex.enable_rigid_flex()
pass

@pytest.mark.skipif(os.name == "posix", reason="Bug on linux")
Expand Down
2 changes: 1 addition & 1 deletion _unittest_ironpython/run_unittests.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
if os.name != "posix":
ansysem_install_dir = os.environ.get("ANSYSEM_INSTALL_DIR", "")
if not ansysem_install_dir:
ansysem_install_dir = os.environ["ANSYSEM_ROOT221"]
ansysem_install_dir = os.environ["ANSYSEM_ROOT222"]
sys.path.append(os.path.join(ansysem_install_dir, "PythonFiles", "DesktopPlugin"))
path_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)), "..")
sys.path.append(path_dir)
Expand Down
2 changes: 1 addition & 1 deletion _unittest_ironpython/run_unittests_batchmode.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ set ANSYSEM_FEATURE_SF6694_NON_GRAPHICAL_COMMAND_EXECUTION_ENABLE=1
set ANSYSEM_FEATURE_SF159726_SCRIPTOBJECT_ENABLE=1
set RUN_UNITTESTS_ARGS=%*
set ANSYSEM_INSTALL_DIR=%ANSYSEM_ROOT221%
"%ANSYSEM_ROOT221%\ansysedt.exe" -ng -RunScriptAndExit "_unittest_ironpython\run_unittests.py"
"%ANSYSEM_ROOT222%\ansysedt.exe" -ng -RunScriptAndExit "_unittest_ironpython\run_unittests.py"
2 changes: 1 addition & 1 deletion _unittest_ironpython/run_unittests_batchmode_linux.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cd /apps/actions-runner/_work/pyaedt/pyaedt
/apps/AnsysEM/v221/Linux64/ansysedt -features=SF159726_SCRIPTOBJECT,SF6694_NON_GRAPHICAL_COMMAND_EXECUTION -RunScriptAndExit _unittest_ironpython/run_unittests.py
/apps/AnsysEM/v222/Linux64/ansysedt -features=SF159726_SCRIPTOBJECT,SF6694_NON_GRAPHICAL_COMMAND_EXECUTION -RunScriptAndExit _unittest_ironpython/run_unittests.py
echo "INFO: Finished"
2 changes: 1 addition & 1 deletion pyaedt/application/Design.py
Original file line number Diff line number Diff line change
Expand Up @@ -3281,7 +3281,7 @@ def get_evaluated_value(self, variable_name, units=None):
else:
var_obj = self.get_oo_object(app, "Variables/{}".format(variable_name))
if var_obj:
if is_ironpython: # pragma: no cover
if is_ironpython or settings.use_grpc_api: # pragma: no cover
val = var_obj.Get_SIValue()
else:
val = var_obj.Get_SIValue
Expand Down
27 changes: 13 additions & 14 deletions pyaedt/desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,18 +170,17 @@ def release_desktop(close_projects=True, close_desktop=True):
for project in projects:
desktop.CloseProject(project)
pid = _main.oDesktop.GetProcessID()
if _com != "pythonnet_v3":
if settings.aedt_version >= "2022.2" and settings.use_grpc_api:
import ScriptEnv

ScriptEnv.Release()
elif not inside_desktop:
i = 0
scopeID = 5
while i <= scopeID:
_main.COMUtil.ReleaseCOMObjectScope(_main.COMUtil.PInvokeProxyAPI, i)
i += 1
_delete_objects()
if settings.aedt_version >= "2022.2" and settings.use_grpc_api and not is_ironpython:
import ScriptEnv

ScriptEnv.Release()
elif not inside_desktop:
i = 0
scopeID = 5
while i <= scopeID:
_main.COMUtil.ReleaseCOMObjectScope(_main.COMUtil.PInvokeProxyAPI, i)
i += 1
_delete_objects()

if close_desktop:
try:
Expand Down Expand Up @@ -640,7 +639,7 @@ def _init_cpython_new(self, non_graphical, new_aedt_session, version, student_ve

launch_msg = "AEDT installation Path {}".format(base_path)
self.logger.info(launch_msg)
self.logger.info("Launching AEDT with PyDesktopPlugin.")
self.logger.info("Launching AEDT with GRPC Plugin.")
if (
not self.port
and not new_aedt_session
Expand Down Expand Up @@ -693,7 +692,7 @@ def _init_cpython_new(self, non_graphical, new_aedt_session, version, student_ve
self.logger.info("{} Started with process ID {}.".format(version, _proc))

else:
self.logger.warning("PyDesktopPlugin is not supported in AEDT versions older than 2022.2.")
self.logger.warning("GRPC Plugin is not supported in AEDT versions older than 2022.2.")

def _set_logger_file(self):
# Set up the log file in the AEDT project directory
Expand Down
3 changes: 3 additions & 0 deletions pyaedt/hfss3dlayout.py
Original file line number Diff line number Diff line change
Expand Up @@ -1570,7 +1570,10 @@ def enable_rigid_flex(self):
-------
bool
`True` if bend is enabled `False` if bend is disabled.
In Non-graphical it returns always True due to bug in native API.
"""
if settings.aedt_version >= "2022.2":
self.modeler.oeditor.ProcessBentModelCmd()
if settings.non_graphical:
return True
return True if self.variable_manager["BendModel"].expression == "1" else False
15 changes: 10 additions & 5 deletions pyaedt/modeler/Object3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -3492,12 +3492,17 @@ def angle(self):
@angle.setter
def angle(self, angle=None):
"""Set the part angle."""
if not angle:
angle = str(self._angle) + "°"
if not settings.use_grpc_api:
if not angle:
angle = str(self._angle) + "°"
else:
angle = _dim_arg(angle, "°")
vMaterial = ["NAME:Component Angle", "Value:=", angle]
self.change_property(vMaterial)
else:
angle = _dim_arg(angle, "°")
vMaterial = ["NAME:Component Angle", "Value:=", angle]
self.change_property(vMaterial)
self._circuit_components._app.logger.error(
"Grpc doesn't support angle settings because special characters are not supported."
)

@property
def mirror(self):
Expand Down
4 changes: 2 additions & 2 deletions pyaedt/modeler/PrimitivesNexxim.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ def components_catalog(self):
return self._components_catalog

@pyaedt_function_handler()
def create_subcircuit(self, location=None, angle=0, name=None, nested_subcircuit_id=None):
def create_subcircuit(self, location=None, angle=None, name=None, nested_subcircuit_id=None):
"""Add a new Circuit subcircuit to the design.

Parameters
----------
location : list of float, optional
Position on the X axis and Y axis.
angle : float, optional
Angle rotation in degrees. The default is ``0``.
Angle rotation in degrees. The default is ``None``.
name : str, optional
Name of the design. The default is ``None``, in which case
a unique name is generated.
Expand Down