Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve tracetools_test and simplify test_tracetools code #109

Merged
merged 2 commits into from Apr 15, 2024

Conversation

christophebedard
Copy link
Member

@christophebedard christophebedard commented Apr 9, 2024

The main/biggest improvement is the new get_event_with_field_value_and_assert() test method, which can simplify this very common bit of code:

my_events = self.get_events_with_field_value('field', value, events)
self.assertNumEventsEqual(my_events, 1)
my_event = my_events[0]

into:

event = self.get_event_with_field_value_and_assert('field', value, events)

I've therefore updated a lot of test code to use this new assert method, which makes it a lot simpler and smaller.

I also renamed assertValidArray() to assertValidStaticArray() and added length checking.

@christophebedard christophebedard self-assigned this Apr 9, 2024
@christophebedard christophebedard force-pushed the christophebedard/improve-test-case-utils branch 3 times, most recently from c381355 to 8baff88 Compare April 10, 2024 01:38
@christophebedard christophebedard force-pushed the christophebedard/improve-test-case-utils branch from 8baff88 to 291c9d9 Compare April 11, 2024 20:32
Signed-off-by: Christophe Bedard <christophe.bedard@apex.ai>
@christophebedard christophebedard force-pushed the christophebedard/improve-test-case-utils branch from 291c9d9 to 4ba8cd0 Compare April 11, 2024 23:25
Copy link
Contributor

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm with green CI.

test_tracetools/test/test_buffer.py Outdated Show resolved Hide resolved
Signed-off-by: Christophe Bedard <christophe.bedard@apex.ai>
@christophebedard
Copy link
Member Author

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@christophebedard
Copy link
Member Author

Thanks for the review.

@christophebedard christophebedard merged commit aa7dcba into rolling Apr 15, 2024
7 of 9 checks passed
@christophebedard christophebedard deleted the christophebedard/improve-test-case-utils branch April 15, 2024 23:44
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.

None yet

2 participants