Fix AttributeError masking dropped AEDT connection in solution_type fallback - #8025
Open
agu2347 wants to merge 2 commits into
Open
Fix AttributeError masking dropped AEDT connection in solution_type fallback#8025agu2347 wants to merge 2 commits into
agu2347 wants to merge 2 commits into
Conversation
…allback design_solutions.py falls back to self._design_type.default_solution when self._odesign.GetSolutionType() raises (e.g. because the gRPC connection to AEDT was lost). Every constant class in generic/aedt_constants.py only defines solution_default, never default_solution, so this fallback itself raises AttributeError. That AttributeError, naming a design-type constant, replaces the original connection error and points debugging in the wrong direction. DesignSolution.solution_type already uses the correct solution_default spelling in its getter; the setter (value=None branch) and HFSSDesignSolution.solution_type getter/setter still used the wrong default_solution spelling. Fix all nine remaining occurrences. Added tests/unit/test_design_solutions.py with unit tests (no AEDT installation required) that reproduce the exact AttributeError against the unfixed code via a fake ODesign whose GetSolutionType() raises, and pass against the fix. Fixes ansys#8020
|
The following people have not signed the Contributors License Agreement (CLA): Read the CLA in the link above and sign it by clicking below: You will receive a confirmation as soon as your signature is captured. Note Action Required: Repository maintainers with write access can trigger a recheck by commenting |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Bug
Reported in #8020.
design_solutions.pyfalls back toself._design_type.default_solutionwhenGetSolutionType()raises, but every constant class ingeneric/aedt_constants.py(HfssConstants,Q3dConstants,IcepakConstants,Maxwell3dConstants,CircuitConstants, etc.) only definessolution_default:The fallback therefore raises
AttributeErroritself. Because this fallback runs exactly when the gRPC connection to AEDT has broken, the user sees'HfssConstants' object has no attribute 'default_solution'instead of a connection error, which points debugging at design types instead of the actual failure.DesignSolution.solution_type's getter already uses the correctsolution_defaultspelling; the setter (value is Nonebranch) and both ofHFSSDesignSolution.solution_type's getter and setter still useddefault_solution. On currentmainthis affects 9 call sites insrc/ansys/aedt/core/application/design_solutions.py, all identical in shape (self._design_type.default_solution).Fix
Rename all 9 remaining
default_solutionaccesses tosolution_default, matching every other call site in the file and the actual attribute the constant classes define. No changes needed to the constants themselves.Testing
No AEDT installation or license is required to reproduce or verify this — the bug is a pure attribute-name mismatch between two Python modules.
Added
tests/unit/test_design_solutions.py:test_constants_only_define_solution_default— confirms the constant classes definesolution_defaultand notdefault_solution.test_design_solution_getter_falls_back_on_connection_error— control, exercises the getter's already-correct branch.test_design_solution_setter_falls_back_on_connection_error— regression test for the setter'svalue is Nonebranch, using a fakeODesignwhoseGetSolutionType()raises to simulate a dropped connection.test_design_solution_setter_no_odesign_falls_back— regression test for the no-_odesignfallback branch.test_hfss_design_solution_getter_falls_back_on_connection_error— regression test forHFSSDesignSolution's getter.Verified all 3 regression tests reproduce the exact reported
AttributeErroragainst the unfixed code (reverteddesign_solutions.pyto the currentmainversion, reran — 3 failed withAttributeError: type object 'HfssConstants'/'Q3dConstants' has no attribute 'default_solution', 2 passed as controls), then reapplied the fix and reran — all 5 pass.Fixes #8020