Skip to content

Commit 21a882b

Browse files
agnersaustina-csa
authored andcommitted
[Python] Reset chip error in test commissioner (project-chip#34001)
* [Python] Reset chip error in test commissioner Make sure to reset the chip error in test commissioner on reset. This avoid spurious errors. The Python side reads the error as soon as mTestCommissionerUsed is set, which happens unconditionally. Hence clearing the error is necessary. * [Python] Remove unexpected exception in TC_CGEN_2_4.py With the test commissioner properly resetting the error code the spurious exception is no longer thrown. Remove the exception handling from the test.
1 parent 506c000 commit 21a882b

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/controller/python/OpCredsBinding.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ class TestCommissioner : public chip::Controller::AutoCommissioner
259259
mPrematureCompleteAfter = chip::Controller::CommissioningStage::kError;
260260
mReadCommissioningInfo = chip::Controller::ReadCommissioningInfo();
261261
mNeedsDST = false;
262+
mCompletionError = CHIP_NO_ERROR;
262263
}
263264
bool GetTestCommissionerUsed() { return mTestCommissionerUsed; }
264265
void OnCommissioningSuccess(chip::PeerId peerId) { mReceivedCommissioningSuccess = true; }

src/python_testing/TC_CGEN_2_4.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,9 @@ async def test_TC_CGEN_2_4(self):
104104
logging.info('Step 16 - TH2 fully commissions the DUT')
105105
self.th2.ResetTestCommissioner()
106106

107-
ctx = asserts.assert_raises(ChipStackError)
108-
with ctx:
109-
self.th2.CommissionOnNetwork(
110-
nodeId=self.dut_node_id, setupPinCode=params.setupPinCode,
111-
filterType=ChipDeviceCtrl.DiscoveryFilterType.LONG_DISCRIMINATOR, filter=self.discriminator)
112-
asserts.assert_true(ctx.exception.chip_error.sdk_code == 0x02, 'Unexpected error code returned from CommissioningComplete')
107+
self.th2.CommissionOnNetwork(
108+
nodeId=self.dut_node_id, setupPinCode=params.setupPinCode,
109+
filterType=ChipDeviceCtrl.DiscoveryFilterType.LONG_DISCRIMINATOR, filter=self.discriminator)
113110
logging.info('Commissioning complete done.')
114111

115112
logging.info('Step 17 - TH1 sends an arm failsafe')

0 commit comments

Comments
 (0)