Skip to content

test_when_timeout_smaller_second is flaky #5116

@derlih

Description

@derlih

🐞 Describe the bug
Sometimes test_when_timeout_smaller_second fails

💡 To Reproduce
Run this test multiple times

pip install pytest-repeat
pytest -q tests/test_helpers.py::test_when_timeout_smaller_second --count 1000 -x

💡 Expected behavior
Test shouldn't fail

📋 Logs/tracebacks

loop = <_UnixSelectorEventLoop running=False closed=False debug=False>

    def test_when_timeout_smaller_second(loop) -> None:
        timeout = 0.1
        timer = loop.time() + timeout
    
        handle = helpers.TimeoutHandle(loop, timeout)
        when = handle.start()._when
        handle.close()
    
        assert isinstance(when, float)
>       assert f"{when:.3f}" == f"{timer:.3f}"
E       AssertionError: assert '151331.472' == '151331.471'
E         - 151331.471
E         ?          ^
E         + 151331.472
E         ?          ^

📋 Your version of the Python

$ python --version
Python 3.8.5

📋 Your version of the aiohttp/yarl/multidict distributions

$ python -m pip show aiohttp
4.0.0a1
$ python -m pip show multidict
5.0.0
$ python -m pip show yarl
1.6.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions