Skip to content

Fix error when capture_source is enabled and test_start is None#1292

Open
harrish243 wants to merge 1 commit into
google:masterfrom
harrish243:fix-issue-1279
Open

Fix error when capture_source is enabled and test_start is None#1292
harrish243 wants to merge 1 commit into
google:masterfrom
harrish243:fix-issue-1279

Conversation

@harrish243

Copy link
Copy Markdown

What does this PR do?
This PR fixes an AttributeError that occurs when the capture_source configuration is enabled but no test_start trigger is provided.

Why is this change needed?
In openhtf/core/test_descriptor.py, if test_start is passed as None, the trigger variable also evaluates to None. When CONF.capture_source is enabled, the code previously attempted to unconditionally access trigger.func, resulting in an error because it tried to get the func attribute on a None value.

How does this PR fix the problem?
I added a simple safety check (if CONF.capture_source and trigger:) so that it only attempts to capture the source code info if a valid trigger function actually exists.

Fixes #1279

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error when capture_source is enabled and test_start is None

1 participant