Skip to content

Commit

Permalink
Merge branch 'main' into feat/Design_edit_note
Browse files Browse the repository at this point in the history
  • Loading branch information
gmalinve authored Oct 11, 2024
2 parents 617e727 + 4e783b5 commit e01cee8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 34 deletions.
50 changes: 20 additions & 30 deletions _unittest_solvers/test_26_emit.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
from ansys.aedt.core.generic.general_methods import is_linux
from ansys.aedt.core.generic import constants as consts

if (3,7) < sys.version_info <(3, 12):
# Prior to 2025R1, the Emit API supported Python 3.8,3.9,3.10,3.11
# Starting with 2025R1, the Emit API supports Python 3.10,3.11,3.12
if ( ( (3, 8) <= sys.version_info[0:2] <= (3, 11) and config["desktopVersion"] < "2025.1" ) or
( (3,10) <= sys.version_info[0:2] <= (3,12) and config["desktopVersion"] > "2024.2" ) ):
from ansys.aedt.core import Emit
from ansys.aedt.core import generate_unique_project_name
from ansys.aedt.core.emit_core.emit_constants import EmiCategoryFilter
Expand All @@ -29,8 +32,9 @@ def aedtapp(add_app):
return app


@pytest.mark.skipif(is_linux, reason="Emit API fails on linux.")
@pytest.mark.skipif(sys.version_info < (3,8) or sys.version_info >=(3, 12), reason="Emit API is only available for Python 3.8+.")
@pytest.mark.skipif(is_linux, reason="Emit API is not supported on linux.")
@pytest.mark.skipif((sys.version_info < (3,8) or sys.version_info > (3,11)) and config["desktopVersion"] < "2025.1", reason="Emit API is only available for Python 3.8-3.11 in AEDT versions 2024.2 and prior.")
@pytest.mark.skipif((sys.version_info < (3,10) or sys.version_info > (3,12)) and config["desktopVersion"] > "2024.2", reason="Emit API is only available for Python 3.10-3.12 in AEDT versions 2025.1 and later.")
class TestClass:

@pytest.fixture(autouse=True)
Expand All @@ -44,21 +48,8 @@ def test_01_objects(self):
assert self.aedtapp.modeler
assert self.aedtapp.oanalysis is None
if self.aedtapp._aedt_version > "2023.1":
if sys.version_info.major == 3 and sys.version_info.minor == 7:
assert str(type(self.aedtapp._emit_api)) == "<class 'EmitApiPython.EmitApi'>"
assert self.aedtapp.results is not None
elif sys.version_info.major == 3 and sys.version_info.minor == 8:
assert str(type(self.aedtapp._emit_api)) == "<class 'EmitApiPython38.EmitApi'>"
assert self.aedtapp.results is not None
elif sys.version_info.major == 3 and sys.version_info.minor == 9:
assert str(type(self.aedtapp._emit_api)) == "<class 'EmitApiPython39.EmitApi'>"
assert self.aedtapp.results is not None
elif sys.version_info.major == 3 and sys.version_info.minor == 10:
assert str(type(self.aedtapp._emit_api)) == "<class 'EmitApiPython310.EmitApi'>"
assert self.aedtapp.results is not None
elif sys.version_info.major == 3 and sys.version_info.minor == 11:
assert str(type(self.aedtapp._emit_api)) == "<class 'EmitApiPython311.EmitApi'>"
assert self.aedtapp.results is not None
assert str(type(self.aedtapp._emit_api)) == f"<class 'EmitApiPython{sys.version_info.major}{sys.version_info.minor}.EmitApi'>"
assert self.aedtapp.results is not None

@pytest.mark.skipif(config["desktopVersion"] <= "2022.1", reason="Skipped on versions earlier than 2021.2")
def test_02_create_components(self, add_app):
Expand Down Expand Up @@ -694,16 +685,7 @@ def test_12_radio_getters(self, add_app):
)
def test_13_static_type_generation(self):
domain = self.aedtapp.results.interaction_domain()
if sys.version_info < (3, 8):
py_version = "EmitApiPython"
elif sys.version_info < (3, 9):
py_version = "EmitApiPython38"
elif sys.version_info < (3, 10):
py_version = "EmitApiPython39"
elif sys.version_info < (3, 11):
py_version = "EmitApiPython310"
elif sys.version_info < (3, 12):
py_version = "EmitApiPython311"
py_version = f"EmitApiPython{sys.version_info[0]}{sys.version_info[1]}"
assert str(type(domain)) == "<class '{}.InteractionDomain'>".format(py_version)

# assert str(type(TxRxMode)) == "<class '{}.tx_rx_mode'>".format(py_version)
Expand Down Expand Up @@ -937,9 +919,13 @@ def test_17_availability_1_to_1(self, add_app):
assert len(radiosRX) == 2

@pytest.mark.skipif(
config["desktopVersion"] <= "2023.1" or TEST_REVIEW_FLAG,
config["desktopVersion"] <= "2023.1",
reason="Skipped on versions earlier than 2023.2",
)
@pytest.mark.skipif(
TEST_REVIEW_FLAG,
reason="Test under review",
)
def test_18_interference_scripts_no_filter(self, add_app):
self.aedtapp = add_app(project_name="interference", application=Emit, subfolder=TEST_SUBFOLDER)

Expand Down Expand Up @@ -998,9 +984,13 @@ def test_19_radio_protection_levels(self, add_app):
assert protection_power_matrix == expected_protection_power

@pytest.mark.skipif(
config["desktopVersion"] <= "2023.1" or TEST_REVIEW_FLAG,
config["desktopVersion"] <= "2023.1",
reason="Skipped on versions earlier than 2023.2",
)
@pytest.mark.skipif(
TEST_REVIEW_FLAG,
reason="Test under review",
)
def test_20_interference_filtering(self, add_app):
self.aedtapp = add_app(project_name="interference", application=Emit, subfolder=TEST_SUBFOLDER)
# Generate a revision
Expand Down
9 changes: 5 additions & 4 deletions src/ansys/aedt/core/modeler/schematic.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@
from ansys.aedt.core.generic.general_methods import pyaedt_function_handler
from ansys.aedt.core.generic.settings import settings
from ansys.aedt.core.modeler.cad.modeler import Modeler
from ansys.aedt.core.modeler.circuits.object_3d_circuit import CircuitComponent
from ansys.aedt.core.modeler.circuits.object_3d_circuit import Wire

if (3, 8) < sys.version_info < (3, 12):
if (3, 7) < sys.version_info < (3, 13):
from ansys.aedt.core.modeler.circuits.primitives_emit import EmitComponent
from ansys.aedt.core.modeler.circuits.primitives_emit import EmitComponents
else: # pragma: no cover
warnings.warn("Emit API is only available for Python 3.8+,<3.12.")
from ansys.aedt.core.modeler.circuits.object_3d_circuit import CircuitComponent
from ansys.aedt.core.modeler.circuits.object_3d_circuit import Wire
warnings.warn("EMIT API is only available for Python 3.8-3.12.")

from ansys.aedt.core.modeler.circuits.primitives_maxwell_circuit import MaxwellCircuitComponents
from ansys.aedt.core.modeler.circuits.primitives_nexxim import NexximComponents
from ansys.aedt.core.modeler.circuits.primitives_twin_builder import TwinBuilderComponents
Expand Down

0 comments on commit e01cee8

Please sign in to comment.