Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.8 test_static_resource failure: TypeError: issubclass() arg 1 must be a class #277

Open
hroncok opened this issue Nov 14, 2019 · 0 comments · May be fixed by #278
Open

Python 3.8 test_static_resource failure: TypeError: issubclass() arg 1 must be a class #277

hroncok opened this issue Nov 14, 2019 · 0 comments · May be fixed by #278

Comments

@hroncok
Copy link

hroncok commented Nov 14, 2019

Hello. I wish to run tests on Python 3.8, but I needed to fight some problems. This is how I was able to run them on current master:

diff --git a/pytest.ini b/pytest.ini
deleted file mode 100644
index e62899b..0000000
--- a/pytest.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[pytest]
-filterwarnings=
-    error
diff --git a/tox.ini b/tox.ini
index 9668d37..bb10832 100644
--- a/tox.ini
+++ b/tox.ini
@@ -5,6 +5,7 @@ envlist = py34, py35, check
 commands = {envpython} setup.py test
 deps =
     pytest
+    pytest-aiohttp
 
 [testenv:check]
 deps =
$ tox -e py38

And this is the error I get:

============================= test session starts ==============================
platform linux -- Python 3.8.0, pytest-5.2.2, py-1.8.0, pluggy-0.13.0
cachedir: .tox/py38/.pytest_cache
rootdir: /home/churchyard/Dokumenty/aiohttp-cors, inifile: tox.ini, testpaths: aiohttp_cors, tests
plugins: cov-2.8.1, pylint-0.14.1, aiohttp-0.3.0
collected 99 items

tests/doc/test_basic_usage.py ..                                         [  2%]
tests/integration/test_main.py ......................................... [ 43%]
.............................                                            [ 72%]
tests/integration/test_real_browser.py ssssss                            [ 78%]
tests/unit/test___about__.py .                                           [ 79%]
tests/unit/test_cors_config.py ....F...                                  [ 87%]
tests/unit/test_mixin.py .....                                           [ 92%]
tests/unit/test_preflight_handler.py .                                   [ 93%]
tests/unit/test_resource_options.py ...                                  [ 96%]
tests/unit/test_urldispatcher_router_adapter.py ...                      [100%]

=================================== FAILURES ===================================
_____________________________ test_static_resource _____________________________

app = <Application 0x7f735d3d6100>
cors = <aiohttp_cors.cors_config.CorsConfig object at 0x7f735d35c400>

    def test_static_resource(app, cors):
        """Test adding static resource."""
        assert len(app.router.keys()) == 0
        app.router.add_static(
            "/file", "/", name="dynamic_named_route")
        assert len(app.router.keys()) == 1
        for resource in list(app.router.resources()):
>           if issubclass(resource, web.StaticResource):

tests/unit/test_cors_config.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'aiohttp.web_urldispatcher.StaticResource'>
subclass = <StaticResource 'dynamic_named_route' /file -> PosixPath('/')>

    def __subclasscheck__(cls, subclass):
        """Override for issubclass(subclass, cls)."""
>       return _abc_subclasscheck(cls, subclass)
E       TypeError: issubclass() arg 1 must be a class

.tox/py38/lib64/python3.8/abc.py:102: TypeError
=============================== warnings summary ===============================
tests/unit/test_cors_config.py:33
  /home/churchyard/Dokumenty/aiohttp-cors/tests/unit/test_cors_config.py:33: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def get(self):

tests/integration/test_main.py::test_dummy_setup[pyloop]
  /home/churchyard/Dokumenty/aiohttp-cors/.tox/py38/lib/python3.8/site-packages/aiohttp/web_server.py:53: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
    await asyncio.gather(*coros, loop=self._loop)

-- Docs: https://docs.pytest.org/en/latest/warnings.html
============= 1 failed, 92 passed, 6 skipped, 2 warnings in 5.91s ==============
hroncok added a commit to hroncok/aiohttp-cors that referenced this issue Nov 14, 2019
@hroncok hroncok linked a pull request Nov 14, 2019 that will close this issue
4 tasks
@mgorny mgorny mentioned this issue Mar 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant