dabeaz / curio

Good Curio!
Other
4.03k stars 241 forks source link

1.5: pytest warnings #344

Open kloczek opened 3 years ago

kloczek commented 3 years ago
+ /usr/bin/python3 -Bm pytest -ra -q -k 'not internet'
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.9, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
Using --randomly-seed=998889562
rootdir: /home/tkloczko/rpmbuild/BUILD/curio-1.5, configfile: setup.cfg, testpaths: tests
plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, httpbin-1.0.0, xdist-2.2.1, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, pyfakefs-4.4.0, freezegun-0.4.2, cases-3.4.6, case-1.5.3, isort-1.3.0, aspectlib-1.5.2, asyncio-0.15.1, toolbox-0.5, xprocess-0.17.1, flaky-3.7.0, aiohttp-0.3.0, checkdocs-2.7.0, mock-3.6.1, rerunfailures-9.1.1, requests-mock-1.9.3, Faker-8.4.0, cov-2.12.1, randomly-3.8.0, hypothesis-6.13.12
collected 262 items / 2 deselected / 260 selected

tests/test_activation.py ...                                                                                                                                         [  1%]
tests/test_task.py ..................................                                                                                                                [ 14%]
tests/test_kernel.py .........................................                                                                                                       [ 30%]
tests/test_subprocess.py ...........                                                                                                                                 [ 34%]
tests/test_channel.py ............s...                                                                                                                               [ 40%]
tests/test_io.py .................s.......                                                                                                                           [ 50%]
tests/test_meta.py ......                                                                                                                                            [ 52%]
tests/test_timequeue.py .                                                                                                                                            [ 52%]
tests/test_workers.py .........                                                                                                                                      [ 56%]
tests/test_file.py ....................                                                                                                                              [ 63%]
tests/test_asyncgen.py .....                                                                                                                                         [ 65%]
tests/test_network.py ......                                                                                                                                         [ 68%]
tests/test_thread.py ..............s.                                                                                                                                [ 74%]
tests/test_sync.py .............................                                                                                                                     [ 85%]
tests/test_socket.py ......s..........                                                                                                                               [ 91%]
tests/test_queue.py .....................                                                                                                                            [100%]

============================================================================= warnings summary =============================================================================
tests/test_kernel.py::test_kernel_no_shutdown
  /usr/lib/python3.8/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning: Exception ignored in: <function Kernel.__del__ at 0x7f380f05c820>

  Traceback (most recent call last):
    File "/home/tkloczko/rpmbuild/BUILD/curio-1.5/curio/kernel.py", line 116, in __del__
      raise RuntimeError(
  RuntimeError: Curio kernel not properly terminated.  Please use Kernel.run(shutdown=True)

    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

tests/test_kernel.py::test_reentrant_kernel
  /home/tkloczko/rpmbuild/BUILD/curio-1.5/tests/test_kernel.py:727: RuntimeWarning: coroutine 'test_reentrant_kernel.<locals>.child' was never awaited
    kernel.run(child)

tests/test_io.py::test_socketstream_blocking
  /usr/lib/python3.8/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning: Exception ignored in: <function Task.__del__ at 0x7f380f06ce50>

  Traceback (most recent call last):
    File "/home/tkloczko/rpmbuild/BUILD/curio-1.5/curio/task.py", line 157, in __del__
      if not self.daemon and not self.exception:
    File "/home/tkloczko/rpmbuild/BUILD/curio-1.5/curio/task.py", line 222, in exception
      raise RuntimeError('Task not terminated')
  RuntimeError: Task not terminated

    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

tests/test_io.py::test_stream_bad_iter
  /home/tkloczko/rpmbuild/BUILD/curio-1.5/tests/test_io.py:883: RuntimeWarning: coroutine 'StreamBase.__anext__' was never awaited
    results.append(True)

tests/test_io.py::test_stream_bad_context
  /home/tkloczko/rpmbuild/BUILD/curio-1.5/tests/test_io.py:850: RuntimeWarning: coroutine 'StreamBase.__aenter__' was never awaited
    results.append(True)

tests/test_meta.py::test_instantiate_coroutine
  /usr/lib/python3.8/site-packages/_pytest/python.py:183: RuntimeWarning: coroutine 'test_instantiate_coroutine.<locals>.coro' was never awaited
    result = testfunction(**testargs)

tests/test_meta.py::test_missing_asynccontextmanager
  /usr/lib/python3.8/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning: Exception ignored in: <async_generator object test_missing_asynccontextmanager.<locals>.manager at 0x7f380ec93160>

  Traceback (most recent call last):
    File "/home/tkloczko/rpmbuild/BUILD/curio-1.5/curio/meta.py", line 224, in _fini_async_gen
      raise RuntimeError("Async generator with async finalization must be wrapped by\n"
  RuntimeError: Async generator with async finalization must be wrapped by
  async with curio.meta.finalize(agen) as agen:
      async for n in agen:
           ...
  See PEP 533 for further discussion.

    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

tests/test_file.py::test_sync_with
  /home/tkloczko/rpmbuild/BUILD/curio-1.5/tests/test_file.py:224: RuntimeWarning: coroutine 'AsyncFile.__aenter__' was never awaited
    assert True

tests/test_thread.py::test_errors
  /home/tkloczko/rpmbuild/BUILD/curio-1.5/tests/test_thread.py:267: RuntimeWarning: coroutine 'simple_coro' was never awaited
    AWAIT(simple_coro(2,3))

-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================= short test summary info ==========================================================================
SKIPPED [1] tests/test_channel.py:399: unconditional skip
SKIPPED [1] tests/test_io.py:799: flaky
SKIPPED [1] tests/test_thread.py:228: unconditional skip
SKIPPED [1] tests/test_socket.py:607: unreliable
=================================================== 256 passed, 4 skipped, 2 deselected, 9 warnings in 95.22s (0:01:35) ====================================================
dabeaz commented 3 years ago

No tests failing. What is the specific concern?

mtelka commented 1 year ago

In addition to the original report, it looks like that with Python 3.9.15 at least one (random) test always fails with PytestUnraisableExceptionWarning.