Comments (4)
Async operation timed out after 5 seconds
That usually means event loop mismatching, e.g. running loop is not set as the current event loop. I don't know how to handle this correctly with pytest, but the idea is that you should either pass loop instance explicitly or call asyncio.set_event_loop(loop)
before running the loop.
from peewee-async.
@juntatalor Could you please provide your non-working code sample?
from peewee-async.
@juntatalor This works for me:
import asyncio
import pytest
from tornado_sample import app as application
from tornado.ioloop import IOLoop
IOLoop.configure('tornado.platform.asyncio.AsyncIOMainLoop')
@pytest.fixture
def app():
# Not sure if we need to explicitly set up the current event lopp
# Test sample works fine with or without these lines
# loop = IOLoop.current().asyncio_loop
# asyncio.set_event_loop(loop)
return application
@pytest.mark.gen_test
def test_hello_world(http_client, base_url):
response = yield http_client.fetch(base_url + '?id=1')
assert response.code == 200
@pytest.mark.gen_test
def test_hello_world_2(http_client, base_url):
response = yield http_client.fetch(base_url + '?id=2')
assert response.code == 200
@pytest.mark.gen_test
def test_hello_world_3(http_client, base_url):
response = yield http_client.fetch(base_url + '?id=3')
assert response.code == 200
from peewee-async.
@rudyryk
Thanks.
The problem was in my
AsyncIOMainLoop().install()
I changed to
IOLoop.configure('tornado.platform.asyncio.AsyncIOMainLoop')
And that solved the problem.
from peewee-async.
Related Issues (20)
- Can we got a connection from pool and set isolation level only for this connection? HOT 1
- Seems context manager allow_sync does not work properly HOT 1
- RuntimeError: Event loop is closed
- A defect of execute insert SQL statement HOT 1
- Should add a method get_or_none HOT 2
- An open stream object is being garbage collected; call "stream.close()" explicitly. HOT 3
- Manager.create_or_get does not respect composite keys
- Remove all depreacted stuff in code:
- How the hell join() works for table with multiple same FK? HOT 4
- With async atomic select is ok but get failed HOT 1
- support SQLite HOT 7
- get_or_none HOT 1
- Update docs for connect to database with ssl HOT 1
- prefetch_add_subquery takes a required parameter prefetch_type (from peewee version 3.15.4) HOT 1
- [question] Project status HOT 1
- Update python version compatibility HOT 1
- Rewrite obosolete tests HOT 1
- Make BaseModel with async methods HOT 1
- Setup ci to release the package by bumping tag version HOT 1
- _prune_fields bug HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from peewee-async.