def filter_test_cases_by_test_env(cls: Type[unittest.TestCase]):
    """Filters test cases to run by test case names implicitly.

    The test cases filtered by any test env compatible with
    the local test env are kept.
    """
    target = detect_target()
    test_env = _get_test_env(target)
    for attr in list(cls.__dict__.keys()):
        if attr.startswith("test_"):
            test_name = attr
            if not _test_runnable_in_env(test_name, test_env):
                delattr(cls, attr)
Filters test cases to run by test case names implicitly.

    The test cases filtered by any test env compatible with
    the local test env are kept.
    
python/aitemplate/testing/test_utils.py