aio-libs / pytest-aiohttp

pytest plugin for aiohttp support
Apache License 2.0
134 stars 24 forks source link

tests are failing #54

Closed EdwardBetts closed 1 month ago

EdwardBetts commented 1 month ago
$ python3 -mpytest -x --asyncio-mode=auto
============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.12.5, pytest-8.3.2, pluggy-1.5.0
benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/edward/src/2024/vendor/pytest-aiohttp
configfile: setup.cfg
testpaths: tests
plugins: remotedata-0.4.1, astropy-header-0.2.2, cov-5.0.0, console-scripts-1.4.1, time-machine-2.13.0, requests_mock-1.12.1, anyio-4.4.0, openfiles-0.6.0, forked-1.6.0, typeguard-4.3.0, mock-3.14.0, astropy-0.11.0, hypothesis-6.105.1, kgb-7.1.1, asyncio-0.20.3, arraydiff-0.6.1, twisted-1.14.1, django-4.5.2, syrupy-4.6.1, flaky-3.8.1, timeout-2.3.1, xdist-3.6.1, tornasync-0.6.0.post2, trio-0.8.0, aiohttp-1.0.5, doctestplus-1.2.1, Faker-26.0.0, filter-subpackage-0.2.0, benchmark-4.0.0, pylama-8.4.1, repeat-0.9.3, httpx-0.30.0
asyncio: mode=Mode.AUTO
collected 10 items                                                                                                                                                                                               

tests/test_fixtures.py F

==================================================================================================== FAILURES ====================================================================================================
______________________________________________________________________________________________ test_aiohttp_plugin _______________________________________________________________________________________________
/home/edward/src/2024/vendor/pytest-aiohttp/tests/test_fixtures.py:107: in test_aiohttp_plugin
    result.assert_outcomes(passed=8)
/usr/lib/python3/dist-packages/_pytest/pytester.py:564: in parseoutcomes
    return self.parse_summary_nouns(self.outlines)
/usr/lib/python3/dist-packages/_pytest/pytester.py:582: in parse_summary_nouns
    raise ValueError("Pytest terminal summary report not found")
E   ValueError: Pytest terminal summary report not found
---------------------------------------------------------------------------------------------- Captured stderr call ----------------------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/_pytest/pytester.py", line 1156, in runpytest_inprocess
    reprec = self.inline_run(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/_pytest/pytester.py", line 1121, in inline_run
    ret = main([str(x) for x in args], plugins=plugins)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 156, in main
    config = _prepareconfig(args, plugins)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 341, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pluggy/_callers.py", line 139, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "/usr/lib/python3/dist-packages/pluggy/_callers.py", line 122, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/_pytest/helpconfig.py", line 105, in pytest_cmdline_parse
    config = yield
             ^^^^^
  File "/usr/lib/python3/dist-packages/pluggy/_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 1140, in pytest_cmdline_parse
    self.parse(args)
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 1490, in parse
    self._preparse(args, addopts=addopts)
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 1377, in _preparse
    self.pluginmanager.load_setuptools_entrypoints("pytest11")
  File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 422, in load_setuptools_entrypoints
    self.register(plugin, name=ep.name)
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 501, in register
    plugin_name = super().register(plugin, name)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 157, in register
    hookimpl_opts = self.parse_hookimpl_opts(plugin, name)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 473, in parse_hookimpl_opts
    return _get_legacy_hook_marks(  # type: ignore[return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 386, in _get_legacy_hook_marks
    warn_explicit_for(cast(FunctionType, method), message)
  File "/usr/lib/python3/dist-packages/_pytest/warning_types.py", line 166, in warn_explicit_for
    raise type(w)(f"{w}\n at {filename}:{lineno}") from None
pytest.PytestDeprecationWarning: The hookimpl pytest_pycollect_makeitem uses old-style configuration options (marks or attributes).
Please use the pytest.hookimpl(tryfirst=True) decorator instead
 to configure the hooks.
 See https://docs.pytest.org/en/latest/deprecations.html#configuring-hook-specs-impls-using-markers
 at /usr/lib/python3/dist-packages/pytest_tornasync/plugin.py:33
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=============================================================================================== 1 failed in 0.17s ================================================================================================
$ 
Dreamsorcerer commented 1 month ago

This is lacking useful information. Is test_fixtures.py your code? If so, provide the code. What is pytest-tornasync? It looks like this is causing the error, rather than anything to do with aiohttp.

EdwardBetts commented 1 month ago

test_fixtures.py is https://github.com/aio-libs/pytest-aiohttp/blob/master/tests/test_fixtures.py

EdwardBetts commented 1 month ago

I tried uninstalling pytest-tornasync. Same error.

Are you able to reproduce the problem, or are the tests passing for you?

$ python3 -mpytest -x --asyncio-mode=auto
=============================================================================== test session starts ================================================================================
platform linux -- Python 3.12.5, pytest-8.3.2, pluggy-1.5.0
rootdir: /home/edward/src/2024/vendor/pytest-aiohttp
configfile: setup.cfg
testpaths: tests
plugins: remotedata-0.4.1, astropy-header-0.2.2, cov-5.0.0, console-scripts-1.4.1, time-machine-2.13.0, requests_mock-1.12.1, anyio-4.4.0, openfiles-0.6.0, forked-1.6.0, typeguard-4.3.0, mock-3.14.0, astropy-0.11.0, hypothesis-6.105.1, kgb-7.1.1, asyncio-0.20.3, arraydiff-0.6.1, twisted-1.14.1, django-4.5.2, syrupy-4.6.1, flaky-3.8.1, timeout-2.3.1, xdist-3.6.1, trio-0.8.0, aiohttp-1.0.5, doctestplus-1.2.1, Faker-26.0.0, filter-subpackage-0.2.0, pylama-8.4.1, repeat-0.9.3, httpx-0.30.0
asyncio: mode=Mode.AUTO
collected 10 items                                                                                                                                                                 

tests/test_fixtures.py F

===================================================================================== FAILURES =====================================================================================
_______________________________________________________________________________ test_aiohttp_plugin ________________________________________________________________________________
/home/edward/src/2024/vendor/pytest-aiohttp/tests/test_fixtures.py:107: in test_aiohttp_plugin
    result.assert_outcomes(passed=8)
/usr/lib/python3/dist-packages/_pytest/pytester.py:564: in parseoutcomes
    return self.parse_summary_nouns(self.outlines)
/usr/lib/python3/dist-packages/_pytest/pytester.py:582: in parse_summary_nouns
    raise ValueError("Pytest terminal summary report not found")
E   ValueError: Pytest terminal summary report not found
------------------------------------------------------------------------------- Captured stderr call -------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/_pytest/pytester.py", line 1156, in runpytest_inprocess
    reprec = self.inline_run(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/_pytest/pytester.py", line 1121, in inline_run
    ret = main([str(x) for x in args], plugins=plugins)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 156, in main
    config = _prepareconfig(args, plugins)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 341, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pluggy/_callers.py", line 139, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "/usr/lib/python3/dist-packages/pluggy/_callers.py", line 122, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/_pytest/helpconfig.py", line 105, in pytest_cmdline_parse
    config = yield
             ^^^^^
  File "/usr/lib/python3/dist-packages/pluggy/_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 1140, in pytest_cmdline_parse
    self.parse(args)
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 1490, in parse
    self._preparse(args, addopts=addopts)
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 1377, in _preparse
    self.pluginmanager.load_setuptools_entrypoints("pytest11")
  File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 422, in load_setuptools_entrypoints
    self.register(plugin, name=ep.name)
  File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 501, in register
    plugin_name = super().register(plugin, name)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 168, in register
    self._verify_hook(hook, hookimpl)
  File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 360, in _verify_hook
    _warn_for_function(argname_warning, hookimpl.function)
  File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 41, in _warn_for_function
    warnings.warn_explicit(
pytest.PytestRemovedIn9Warning: The (path: py.path.local) argument is deprecated, please use (file_path: pathlib.Path)
see https://docs.pytest.org/en/latest/deprecations.html#py-path-local-arguments-for-hooks-replaced-with-pathlib-path
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================================================ 1 failed in 0.17s =================================================================================
$ 
Dreamsorcerer commented 1 month ago

That's a completely different error?

Dreamsorcerer commented 1 month ago

Again, your test seems to be working when I run it. I think you should create a new env and only install the pytest plugins needed for the test.

When running, I just get normal assertion errors from the tests:

============================================================================================== short test summary info ==============================================================================================
FAILED test_server.py::test_aiohttp_plugin - AssertionError: assert {'errors': 0,...pped': 0, ...} == {'errors': 0,...pped': 0, ...}
FAILED test_server.py::test_aiohttp_raw_server - AssertionError: assert {'errors': 0,...pped': 0, ...} == {'errors': 0,...pped': 0, ...}
FAILED test_server.py::test_aiohttp_client_cls_fixture_custom_client_used - AssertionError: assert {'errors': 0,...pped': 0, ...} == {'errors': 0,...pped': 0, ...}
FAILED test_server.py::test_aiohttp_client_cls_fixture_factory - AssertionError: assert {'errors': 0,...pped': 0, ...} == {'errors': 0,...pped': 0, ...}

Results (4.11s):
       4 failed
         - test_server.py:6 test_aiohttp_plugin
         - test_server.py:110 test_aiohttp_raw_server
         - test_server.py:145 test_aiohttp_client_cls_fixture_custom_client_used
         - test_server.py:172 test_aiohttp_client_cls_fixture_factory
EdwardBetts commented 1 month ago

Sorry. I tried removing pytest plugins and I eventually found it is pylama that causes the problem.

https://github.com/klen/pylama