Issue #11761: make tests for gc.get_count() less fragile