Skip to content

FIX: Wait for active project after ImportEDB (#7560)#7561

Draft
Devin-Crawford wants to merge 5 commits intomainfrom
fix/7560-edb-import-error
Draft

FIX: Wait for active project after ImportEDB (#7560)#7561
Devin-Crawford wants to merge 5 commits intomainfrom
fix/7560-edb-import-error

Conversation

@Devin-Crawford
Copy link
Copy Markdown
Contributor

ImportEDB is an asynchronous AEDT operation. Calling active_project() immediately after ImportEDB returns None, which caused:
AttributeError: 'NoneType' object has no attribute 'Save'

Added a retry loop (up to 30 s, 0.5 s intervals) in the oproject setter after the ImportEDB call so the setter waits until AEDT finishes loading the project before attempting to call Save().

Also added unit tests in tests/unit/test_design_oproject.py that validate:

  • Retry succeeds on the Nth poll when project becomes available
  • RuntimeError is raised after the 30 s timeout
  • .aedb folder paths are resolved to edb.def before calling ImportEDB

Issue linked

#7560

ImportEDB is an asynchronous AEDT operation. Calling active_project()
immediately after ImportEDB returns None, which caused:
  AttributeError: 'NoneType' object has no attribute 'Save'

Added a retry loop (up to 30 s, 0.5 s intervals) in the oproject setter
after the ImportEDB call so the setter waits until AEDT finishes loading
the project before attempting to call Save().

Also added unit tests in tests/unit/test_design_oproject.py that validate:
- Retry succeeds on the Nth poll when project becomes available
- RuntimeError is raised after the 30 s timeout
- .aedb folder paths are resolved to edb.def before calling ImportEDB

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Devin-Crawford Devin-Crawford requested a review from a team as a code owner April 17, 2026 10:52
@github-actions github-actions bot added the bug Something isn't working label Apr 17, 2026
@Devin-Crawford Devin-Crawford marked this pull request as draft April 17, 2026 12:07
Devin-Crawford and others added 2 commits April 17, 2026 18:40
…7560)

- Added `edb_import_timeout` (default 300 s) to the central `Settings`
  class so the EDB import wait time can be tuned per-project via the PyAEDT
  YAML settings file (general.edb_import_timeout) rather than being buried
  in source code.

- Updated the `oproject` setter in `design.py` to read the timeout from
  `settings.edb_import_timeout` instead of a hardcoded literal.  Also
  standardised the progress-log interval to 15 s and switched to f-string-
  free `logger.info` formatting for consistency.

- Updated the unit tests to patch `settings` directly so each test uses an
  explicit timeout value and is not sensitive to the global default.

- Added `test_edb_import_oproject_is_valid` system test (layout EDB suite)
  that opens the real `ANSYS-HSD_V1.aedb` fixture through the normal
  `Hfss3dLayout(project=<aedb_path>)` constructor path and asserts:
    * `_oproject` is not `None` after construction
    * `_oproject.Save()` does not raise
    * `project_name` is a non-empty string

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants