fix(rf): FXC-3877 more robust suppression of RF license warning #2938
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.
Greptile Overview
Updated On: 2025-10-29 01:51:19 UTC
Greptile Summary
Replaces the brittle
is_running_pytest()function (which checked for pytest in sys.modules) with a more explicit environment variable-based approach. The RF license warning is now suppressed during tests viaTIDY3D_MICROWAVE__SUPPRESS_RF_LICENSE_WARNING=truein pytest config.Key changes:
tidy3d/utils.pyentirely (contained only theis_running_pytest()helper)MicrowaveBaseModelto useconfig.microwave.suppress_rf_license_warninginstead of the deprecated flat config pathTIDY3D_MICROWAVE__SUPPRESS_RF_LICENSE_WARNING=trueto pytest environment variables inpyproject.tomldefault_contructed→default_constructedBenefits:
Confidence Score: 5/5
Important Files Changed
File Analysis
Sequence Diagram
sequenceDiagram participant Pytest participant EnvLoader as ConfigLoader.load_environment_overrides() participant Config as config.microwave participant MWBase as MicrowaveBaseModel participant Logger as log.warning() Note over Pytest: pytest starts with env var:<br/>TIDY3D_MICROWAVE__SUPPRESS_RF_LICENSE_WARNING=true Pytest->>EnvLoader: Parse TIDY3D_* environment variables EnvLoader->>Config: Set suppress_rf_license_warning = True Note over MWBase: User instantiates MicrowaveBaseModel subclass MWBase->>MWBase: _warn_rf_license() validator runs MWBase->>Config: Check config.microwave.suppress_rf_license_warning alt suppress_rf_license_warning == True Config-->>MWBase: True (suppressed) Note over MWBase: Skip warning else suppress_rf_license_warning == False Config-->>MWBase: False MWBase->>Logger: Emit RF license warning end Note over MWBase: Alternative: _default_without_license_warning() MWBase->>Config: Temporarily set suppress_rf_license_warning = True MWBase->>MWBase: Instantiate cls() MWBase->>Config: Restore suppress_rf_license_warning = False