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

Pin pytest-asyncio to <0.11 #737

Merged
merged 1 commit into from Apr 21, 2020
Merged

Conversation

sk1p
Copy link
Member

@sk1p sk1p commented Apr 21, 2020

Works around bug in latest version (pytest-dev/pytest-asyncio#154)


base_url = 'http://127.0.0.1:45153', http_client = <aiohttp.client.ClientSession object at 0x7f2cfedb1e90>

    @pytest.mark.asyncio
    async def test_start_server(base_url, http_client):
        """
        start the server and HTTP GET '/', which should
        return a 200 status code
        """
        url = base_url
>       async with http_client.get(url) as response:

tests/server/test_startup.py:36:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py37/lib/python3.7/site-packages/aiohttp/client.py:1012: in __aenter__
    self._resp = await self._coro
.tox/py37/lib/python3.7/site-packages/aiohttp/client.py:426: in _request
    with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <aiohttp.helpers.TimerContext object at 0x7f2cfefefd10>

    def __enter__(self) -> BaseTimerContext:
        task = current_task(loop=self._loop)

        if task is None:
>           raise RuntimeError('Timeout context manager should be used '
                               'inside a task')
E           RuntimeError: Timeout context manager should be used inside a task

.tox/py37/lib/python3.7/site-packages/aiohttp/helpers.py:579: RuntimeError

Another workaround is adding event_loop to all asyncio test cases as a fixture.

Works around bug in latest version:

_____________________ test_start_server __________________________________________________________________

base_url = 'http://127.0.0.1:45153', http_client = <aiohttp.client.ClientSession object at 0x7f2cfedb1e90>

    @pytest.mark.asyncio
    async def test_start_server(base_url, http_client):
        """
        start the server and HTTP GET '/', which should
        return a 200 status code
        """
        url = base_url
>       async with http_client.get(url) as response:

tests/server/test_startup.py:36:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py37/lib/python3.7/site-packages/aiohttp/client.py:1012: in __aenter__
    self._resp = await self._coro
.tox/py37/lib/python3.7/site-packages/aiohttp/client.py:426: in _request
    with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <aiohttp.helpers.TimerContext object at 0x7f2cfefefd10>

    def __enter__(self) -> BaseTimerContext:
        task = current_task(loop=self._loop)

        if task is None:
>           raise RuntimeError('Timeout context manager should be used '
                               'inside a task')
E           RuntimeError: Timeout context manager should be used inside a task

.tox/py37/lib/python3.7/site-packages/aiohttp/helpers.py:579: RuntimeError
@sk1p sk1p added bug Something isn't working infra Test/Build/Release infrastructure labels Apr 21, 2020
@sk1p sk1p added this to the 0.5 milestone Apr 21, 2020
@codecov
Copy link

codecov bot commented Apr 21, 2020

Codecov Report

Merging #737 into master will decrease coverage by 0.05%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #737      +/-   ##
==========================================
- Coverage   58.78%   58.73%   -0.06%     
==========================================
  Files         230      230              
  Lines        8694     8721      +27     
  Branches     1133     1138       +5     
==========================================
+ Hits         5111     5122      +11     
- Misses       3390     3406      +16     
  Partials      193      193              
Impacted Files Coverage Δ
src/libertem/api.py 87.96% <0.00%> (ø)
src/libertem/udf/base.py 89.78% <0.00%> (ø)
src/libertem/udf/stddev.py 97.89% <0.00%> (ø)
src/libertem/analysis/com.py 96.42% <0.00%> (ø)
client/src/dataset/helpers.ts 0.00% <0.00%> (ø)
src/libertem/io/writers/results/base.py 100.00% <0.00%> (ø)
client/src/dataset/components/DatasetOpen.tsx 0.00% <0.00%> (ø)
...lient/src/compoundAnalysis/components/Download.tsx 0.00% <0.00%> (ø)
src/libertem/web/base.py 93.61% <0.00%> (+0.13%) ⬆️
src/libertem/io/dataset/hdf5.py 90.96% <0.00%> (+0.16%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9329b12...2d2a991. Read the comment docs.

@sk1p sk1p merged commit 9557ff6 into LiberTEM:master Apr 21, 2020
@sk1p sk1p deleted the pin-pytest-asyncio branch April 21, 2020 13:06
@sk1p sk1p mentioned this pull request May 4, 2020
5 tasks
@sk1p sk1p mentioned this pull request Sep 11, 2020
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working infra Test/Build/Release infrastructure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant