[Python] Reset chip error in test commissioner (#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.
diff --git a/src/controller/python/OpCredsBinding.cpp b/src/controller/python/OpCredsBinding.cpp
index 427ee9b..f581592 100644
--- a/src/controller/python/OpCredsBinding.cpp
+++ b/src/controller/python/OpCredsBinding.cpp
@@ -259,6 +259,7 @@
mPrematureCompleteAfter = chip::Controller::CommissioningStage::kError;
mReadCommissioningInfo = chip::Controller::ReadCommissioningInfo();
mNeedsDST = false;
+ mCompletionError = CHIP_NO_ERROR;
}
bool GetTestCommissionerUsed() { return mTestCommissionerUsed; }
void OnCommissioningSuccess(chip::PeerId peerId) { mReceivedCommissioningSuccess = true; }