Skip to content

Commit c16e08a

Browse files
committedApr 29, 2024·
Make error message more specific
1 parent b34d869 commit c16e08a

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed
 

‎src/python_testing/TC_DA_1_7.py

+16-11
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,12 @@ class TC_DA_1_7(MatterBaseTest):
109109
--discriminator 12 34 --passcode 20202021 20202021 --bool-arg allow_sdk_dac:true"
110110
'''
111111

112-
def expected_number_of_DUTs(self):
113-
# For real tests, we require more than one DUT
114-
# On the CI, this doesn't make sense to do since all the examples use the same DAC
115-
# To specify more than 1 DUT, use a list of discriminators and passcodes
116-
allow_sdk_dac = self.user_params.get("allow_sdk_dac", False)
117-
post_cert_test = self.user_params.get("post_cert_test", False)
118-
if allow_sdk_dac or post_cert_test:
119-
return 1
120-
return 2
112+
def setup_class(self):
113+
self.allow_sdk_dac = self.user_params.get("allow_sdk_dac", False)
114+
self.post_cert_test = self.user_params.get("post_cert_test", False)
115+
116+
def expected_number_of_DUTs() -> int:
117+
return 1 if (self.allow_sdk_dac or self.post_cert_test) else 2
121118

122119
def steps_one_dut(self, DUT: int) -> List[TestStep]:
123120
return [TestStep(f'{DUT}', f'Test DUT{DUT} DAC chain as follows:'),
@@ -158,8 +155,16 @@ async def test_TC_DA_1_7(self):
158155
num += 1
159156
if self.matter_test_config.manual_code:
160157
num += 1
161-
asserts.assert_equal(num, self.expected_number_of_DUTs(),
162-
"Unexpected number of devices specified - this test expects two DUTs at cert, one device for CI")
158+
159+
if num != expected_num:
160+
if self.allow_sdk_dac:
161+
msg = "The allow_sdk_dac flag is only for use in CI. When using this test in CI, please specify a single discriminator, manual-code or qr-code-content"
162+
elif self.post_cert_test:
163+
msg = "The post_cert_test flag is only for use post-certification. When using this flag, please specify a single discriminator, manual-code or qr-code-content"
164+
else:
165+
msg = "This test requires two devices for use at certification. Please specify two device discriminators ex. --discriminator 1234 5678"
166+
asserts.fail(msg)
167+
163168
pk = []
164169
# Commissioning - already done.
165170
self.step(0)

0 commit comments

Comments
 (0)
Please sign in to comment.