soxoj / maigret

🕵️‍♂️ Collect a dossier on a person by username from thousands of sites
https://t.me/osint_maigret_bot
MIT License
10.01k stars 775 forks source link

test_asyncio_progressbar_executor failing on darwin #679

Open erdnaxe opened 1 year ago

erdnaxe commented 1 year ago

Checklist

Description

Info about Maigret version you are running and environment (--version, operation system, ISP provider): trying to build and test 0.4.4

Running on Nixpkgs master, the problem can be seen in the test runner of the 0.4.3 to 0.4.4 upgrade: https://github.com/NixOS/nixpkgs/pull/194216

How to reproduce this bug (commandline options / conditions): Build and run tests on Darwin aarch64 or x86_64, using Nixpkgs master versions.

=================================== FAILURES ===================================
______________________ test_asyncio_progressbar_executor _______________________
    @pytest.mark.asyncio
    async def test_asyncio_progressbar_executor():
        tasks = [(func, [n], {}) for n in range(10)]

        executor = AsyncioProgressbarExecutor(logger=logger)
        # no guarantees for the results order
        assert sorted(await executor.run(tasks)) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
        assert executor.execution_time > 0.2
>       assert executor.execution_time < 0.3
E       assert 0.7072508335113525 < 0.3
E        +  where 0.7072508335113525 = <maigret.executors.AsyncioProgressbarExecutor object at 0x10fa2db70>.execution_time
tests/test_executors.py:37: AssertionError

I don't own MacOS devices, so I am unable to reproduce the bug outside of Nixpkgs continuous integration.

This is definitely strange: AsyncioProgressbarExecutor is the only executor to take ~0.7 seconds to execute in tests/test_executors.py tests, and this happens only on Darwin (MacOS), not on Linux. Do you have any idea of why this could happen?

soxoj commented 1 year ago

Very interesing, thanks. I'll try to explore it