But a weak pump might not immediately cause a code. It might only show symptoms like poor acceleration, sputtering, or stalling before the computer registers a problem serious enough to trigger the light. The failure mode of the pump matters too. Some failures are gradual, while others are more abrupt.
Therefore, while a bad fuel pump *could* illuminate the check engine light, it's more reliable to diagnose a failing fuel pump through other symptoms like those mentioned above, a fuel pressure test, or by checking for diagnostic trouble codes using a scan tool.