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

Create an asserts.py or similar splitout to share asserts for test cases #37011

Open
andy31415 opened this issue Jan 9, 2025 · 2 comments · May be fixed by #37083
Open

Create an asserts.py or similar splitout to share asserts for test cases #37011

andy31415 opened this issue Jan 9, 2025 · 2 comments · May be fixed by #37083
Assignees

Comments

@andy31415
Copy link
Contributor

#36997 updated some asserts to be easier to read, however they are still repeated across different files.

We should enhance existing mobly asserts with some chip asserts for any custom typical operations like is_valid_.... checks for numbers/strings, validation of MEI values, validation of ranges and so on (e.g. https://github.com/project-chip/connectedhomeip/blob/master/src/python_testing/matter_testing_infrastructure/chip/testing/global_attribute_ids.py#L119 has some is_valid/standard/.... checks but as bools not as assets).

We should build an asserts module that builds upon mobly assertions to add matter specific ones somewhere in matter_testing_infrastructure and start using them (we could have something like matter_asserts.assert_valid_uint32(....) in the code.

@asirko-soft
Copy link
Contributor

asirko-soft commented Jan 16, 2025

For this task the approach would be the following:

  1. create matter_assers.py that would contain high reuse like "valid string/integer" or "integer in range" and so on, based on a mobly asserts.
  2. is_ checks from global_attribute_ids.py should be wrapped into proper asserts and placed in matter_asserts.py
  3. create followup PR to convert existing tests to use the new asserts module
  4. update documentation

@asirko-soft
Copy link
Contributor

First step is ready for review in PR: #37083

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

2 participants