How can I avoid `pytest_generate_tests` being called multiple times when parent and child test classes share the same parameters?

I’m using pytest_generate_tests to dynamically parameterize tests in a parent class inherited by multiple child classes.

Since some test data is identical across children, the hook gets called multiple times unnecessarily.

How can I optimize it to avoid repeated calls?