Cadair / parfive

An asyncio based parallel file downloader for Python 3.8+

Home Page:https://parfive.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pytest 6.2.5: Unraisable Exception Warning

Hellseher opened this issue · comments

Hi,

  • Python 3.9
  • Pytest 6.2.5

During packing your project for Guix I've got the warning during check phase:

=============================== warnings summary ===============================
parfive/tests/test_downloader.py::test_async_download[True]
parfive/tests/test_downloader.py::test_download_unique
parfive/tests/test_downloader.py::test_custom_user_agent
  /gnu/store/7frqm5ijy66f81hr8i1j6791k84lds9w-python-pytest-6.2.5/lib/python3.9/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning: Exception ignored in: <function BaseEventLoop.__del__ at 0x7ffff65cd280>

  Traceback (most recent call last):
    File "/gnu/store/65i3nhcwmz0p8rqbg48gaavyky4g4hwk-python-3.9.9/lib/python3.9/asyncio/base_events.py", line 683, in __del__
      self.close()
    File "/gnu/store/65i3nhcwmz0p8rqbg48gaavyky4g4hwk-python-3.9.9/lib/python3.9/asyncio/unix_events.py", line 61, in close
      self.remove_signal_handler(sig)
    File "/gnu/store/65i3nhcwmz0p8rqbg48gaavyky4g4hwk-python-3.9.9/lib/python3.9/asyncio/unix_events.py", line 150, in remove_signal_handler
      signal.signal(sig, handler)
    File "/gnu/store/65i3nhcwmz0p8rqbg48gaavyky4g4hwk-python-3.9.9/lib/python3.9/signal.py", line 47, in signal
      handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
  ValueError: signal only works in main thread of the main interpreter

    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

-- Docs: https://docs.pytest.org/en/stable/warnings.html
======================= 53 passed, 3 warnings in 12.43s ========================

Hi @Hellseher

Do you have any way I can try and reproduce this? It isn't happening on the CI or my local machine. Is it specific to your build environment or can you reproduce it other ways?

Oh I take that back, it is in the CI, it's just not causing an error: https://github.com/Cadair/parfive/actions/runs/3337872611/jobs/5524783433#step:9:318

I shall have a look into it.

Hi @Hellseher

Do you have any way I can try and reproduce this? It isn't happening on the CI or my local machine. Is it specific to your build environment or can you reproduce it other ways?

Hi @Cadair
You may reproudce it in GNU/Linux Debian distribution or directly using Guix:

Debian

sudo apt-get install guix
guix pull
guix time-machine --commit=93be56a3ab28ed0a482f354b7f536681c99b6999 -- build --no-substitutes --verbosity=5 parfive

Guix

guix pull
guix time-machine --commit=93be56a3ab28ed0a482f354b7f536681c99b6999 -- build --no-substitutes --verbosity=5 parfive

Current version and inputs

guix show parfive

name: parfive
version: 2.0.1
...
systems: x86_64-linux
dependencies: python-aiofiles@0.6.0 python-aioftp@0.21.4 python-aiohttp@3.8.1 python-pytest-asyncio@0.17.2 python-pytest-cov@3.0.0 python-pytest-localserver@0.5.0 python-pytest-socket@0.5.1 python-pytest@6.2.5 python-setuptools-scm@6.3.2 python-tqdm@4.64.1
...

This is related to #131 I assume, and unfortunately seems to not be mitigated by #133

I really don't know why this happens! 😓

This issue was resolved to switch to pytest@7.1.3.