Clearing the codes and extinquishing the CEL, or just clearing the codes even if the CEL is not on, resets among other things the readiness monitor tests to incomplete.
In CA, the rules allow only 2 (any 2) of the supported readiness monitor tests to be set to imcomplete. Any more than 2 and the vehicle fails its smog check.
After you clear the codes, extinquish the CEL, you need to drive the car some. I have found about a 30 mile drive of a mixture of cold start, idling, city driving, some cruising at a steady speed will have the readiness monitor tests set to complete, unless of course the DME stumbles upon the problem that had the light on in the first place. In which case it will turn on the light again and log the appropriate error codes.
Sincerely,
MarcW.