gramps.gen.filters.rules.test.person_rules_test.FilterMatchProxyDbTest() should generate an error on Github, but it doesn't

Hello,
The code below produce error (as it should) when I run it locally on Debian 13:

class FilterMatchProxyDbTest(unittest.TestCase):
    PRIVATE_PERSON_ID = "I0988"
    CHILD_OF_PRIVATE_ID = "I0092"

    @classmethod
    def setUpClass(cls):
        raw_db = import_as_dict(EXAMPLE, User())
        cls.db = raw_db
        cls.proxy_db = PrivateProxyDb(raw_db)

        # Confirm setup assumptions
        private_person = raw_db.get_person_from_gramps_id(cls.PRIVATE_PERSON_ID)
        assert (
            private_person is not None and private_person.private
        ), "Test setup: I0988 must be private in example.gramps"
        assert (
            cls.proxy_db.get_person_from_handle(private_person.handle) is None
        ), "Test setup: PrivateProxyDb must hide private people"

When I run:

LANG=en_US.utf-8 GDK_BACKEND=- GRAMPS_RESOURCES=build/share python3 -m unittest  discover -t . -s ./gramps/gen/filters/rules -p "*test.py"

I get:

ERROR: setUpClass (gramps.gen.filters.rules.test.person_rules_test.FilterMatchProxyDbTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/petr/Gramps/gramps/gen/filters/rules/test/person_rules_test.py", line 1663, in setUpClass
    private_person is not None and private_person.private
AssertionError: Test setup: I0988 must be private in example.gramps

The root cause is this line: raw_db = import_as_dict(EXAMPLE, User()). It had to be changed to:

    cls.db = import_as_dict(
        EXAMPLE,
        User(),
        person_prefix="I%04d",
        media_prefix="O%04d",
        family_prefix="F%04d",
        source_prefix="S%04d",
        citation_prefix="C%04d",
        place_prefix="P%04d",
        event_prefix="E%04d",
        repository_prefix="R%04d",
        note_prefix="N%04d",
    )

similar to line 155 of the same file. But what I can not understand is why the test pass on Github!

Gemini suggested that it might happen because optimization removes assert (somehow). To test I ran (note the -O flag):

LANG=en_US.utf-8 GDK_BACKEND=- GRAMPS_RESOURCES=build/share python3 -O -m unittest  discover -t . -s ./gramps/gen/filters/rules -p "*test.py"

And got two errors instead of one:

ERROR: test_IsChildOfFilterMatch_proxy_excludes_private_seed (gramps.gen.filters.rules.test.person_rules_test.FilterMatchProxyDbTest.test_IsChildOfFilterMatch_proxy_excludes_private_seed)
When the seed filter contains only the private person I0988,
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/petr/Gramps/gramps/gen/filters/rules/test/person_rules_test.py", line 1695, in test_IsChildOfFilterMatch_proxy_excludes_private_seed
    self.db.get_person_from_gramps_id(self.CHILD_OF_PRIVATE_ID).handle,
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'handle'

======================================================================
ERROR: test_IsParentOfFilterMatch_proxy_excludes_private_from_result (gramps.gen.filters.rules.test.person_rules_test.FilterMatchProxyDbTest.test_IsParentOfFilterMatch_proxy_excludes_private_from_result)
When the seed filter contains I0092 (child of private I0988),
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/petr/Gramps/gramps/gen/filters/rules/test/person_rules_test.py", line 1714, in test_IsParentOfFilterMatch_proxy_excludes_private_from_result
    ).handle
      ^^^^^^
AttributeError: 'NoneType' object has no attribute 'handle'

These errors are expected and the change proposed above removes them too. But again, why the test pass on Github?

To be honest there are many other unit tests failing on my machine, so the problem may be in my environment. But this particular case seems very strange - it must not work on maintenance/gramps61. Please have a look.

Looks like one of the remaining tests that behaves differently when the settings are different between local and CI. Your changes to pass in those extra values are correct.