pimutils/vdirsyncer

TestVobjectMachine is failing

Closed this issue · 1 comments

Hi, when we build the Arch Linux package and run the test suite, one of the tests currently fails:

__________________________ TestVobjectMachine.runTest __________________________

self = <hypothesis.stateful.VobjectMachine.TestCase testMethod=runTest>

    def runTest(self):
>       run_state_machine_as_test(cls, settings=self.settings)

/usr/lib/python3.12/site-packages/hypothesis/stateful.py:437:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.12/site-packages/hypothesis/stateful.py:241: in run_state_machine_as_test
    run_state_machine(state_machine_factory)
/usr/lib/python3.12/site-packages/hypothesis/stateful.py:108: in run_state_machine
    @given(st.data())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = VobjectMachine({'parsed': [VarReference(name='parsed_0')],
 'unparsed': [VarReference(name='unparsed_0')]})
c = <vdirsyncer.vobject._Component object at 0x718d86f17fb0>, key = '0'
value = '1'

    @rule(c=Parsed, key=uid_strategy, value=uid_strategy)
    def add_prop(self, c, key, value):
        c[key] = value
>       assert c[key] == value
E       AssertionError: assert '0' == '1'
E
E         - 1
E         + 0
E       Falsifying example:
E       state = VobjectMachine()
E       unparsed_0 = state.get_unparsed_lines(encoded=False, joined=False)
E       parsed_0 = state.parse(unparsed=unparsed_0)
E       state.add_prop_raw(c=parsed_0, key='0', params=[], value='0')
E       state.add_prop_raw(c=parsed_0, key='0', params=[], value='0')
E       state.add_prop(c=parsed_0, key='0', value='1')
E       state.teardown()

tests/unit/utils/test_vobject.py:334: AssertionError

There is also a bunch of warnings:

=============================== warnings summary ===============================
tests/conftest.py:48
  /build/vdirsyncer/src/vdirsyncer/tests/conftest.py:48: HypothesisDeprecationWarning: `HealthCheck.all()` is deprecated; use `list(HealthCheck)` instead.
      The `hypothesis codemod` command-line tool can automatically refactor your code to fix this warning.
    suppress_health_check=HealthCheck.all(),

../../../../usr/lib/python3.12/site-packages/pytest_asyncio/plugin.py:255
  /usr/lib/python3.12/site-packages/pytest_asyncio/plugin.py:255: PytestDeprecationWarning: aio_connector is asynchronous and explicitly requests the "event_loop" fixture. Asynchronous fixtures and test functions should use "asyncio.get_running_loop()" instead.
    warnings.warn(

../../../../usr/lib/python3.12/site-packages/pytest_asyncio/plugin.py:255
  /usr/lib/python3.12/site-packages/pytest_asyncio/plugin.py:255: PytestDeprecationWarning: aio_session is asynchronous and explicitly requests the "event_loop" fixture. Asynchronous fixtures and test functions should use "asyncio.get_running_loop()" instead.
    warnings.warn(

../../../../usr/lib/python3.12/site-packages/_hypothesis_pytestplugin.py:442
  /usr/lib/python3.12/site-packages/_hypothesis_pytestplugin.py:442: PytestRemovedIn9Warning: Marks applied to fixtures have no effect
  See docs: https://docs.pytest.org/en/stable/deprecations.html#applying-a-mark-to-a-fixture-function
    return _orig_call(self, function)

../../../../usr/lib/python3.12/site-packages/pytest_asyncio/plugin.py:255
  /usr/lib/python3.12/site-packages/pytest_asyncio/plugin.py:255: PytestDeprecationWarning: conflict_state is asynchronous and explicitly requests the "event_loop" fixture. Asynchronous fixtures and test functions should use "asyncio.get_running_loop()" instead.
    warnings.warn(

tests/unit/test_repair.py:20
  /build/vdirsyncer/src/vdirsyncer/tests/unit/test_repair.py:20: HypothesisDeprecationWarning: `HealthCheck.all()` is deprecated; use `list(HealthCheck)` instead.
      The `hypothesis codemod` command-line tool can automatically refactor your code to fix this warning.
    @settings(suppress_health_check=HealthCheck.all())

tests/unit/test_repair.py:43
  /build/vdirsyncer/src/vdirsyncer/tests/unit/test_repair.py:43: HypothesisDeprecationWarning: `HealthCheck.all()` is deprecated; use `list(HealthCheck)` instead.
      The `hypothesis codemod` command-line tool can automatically refactor your code to fix this warning.
    @settings(suppress_health_check=HealthCheck.all())

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

Note that the failure is happening with Python 3.12 as well as Python 3.13 for which there is an ongoing rebuild. Any ideas what is going wrong?

Note that the Arch Linux runs the tests as follows:

  export DETERMINISTIC_TESTS=true
  # Override addopts as they invoke coverage testing
  pytest --override-ini="addopts="

When I remove export DETERMINISTIC_TESTS=true, the test passes (at least in the majority of the cases) 🤷

However, random tests are bad for packaging and the vdirsyncer documentation also recommends enabling deterministic tests.