Skip to content

Commit

Permalink
refactor: use asyncio.run instead of run_until_complete
Browse files Browse the repository at this point in the history
  • Loading branch information
mkniewallner committed Jan 8, 2022
1 parent d4232b1 commit a8a3553
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ async def run():
# {'data': {'hello': 'hello Chuck'}}

if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
asyncio.run(run())
```

More details on the [API Documentation](https://tartiflette.io/docs/api/engine/)
Expand Down
5 changes: 2 additions & 3 deletions tests/functional/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def _get_sdl_path(*args):
_TTFTT_ENGINES = {}
for schema_name, sdl in _SCHEMAS.items():
sdl, extra = sdl if isinstance(sdl, tuple) else (sdl, {})
_TTFTT_ENGINES[schema_name] = asyncio.get_event_loop().run_until_complete(
_TTFTT_ENGINES[schema_name] = asyncio.run(
create_engine(sdl, schema_name=schema_name, **extra)
)

Expand Down Expand Up @@ -157,8 +157,7 @@ def pytest_runtest_setup(item):
"inst"
] = _TTFTT_ENGINES[schema_name]._schema

loop = asyncio.new_event_loop()
loop.run_until_complete(_TTFTT_ENGINES[schema_name]._schema.bake())
asyncio.run(_TTFTT_ENGINES[schema_name]._schema.bake())


def pytest_configure(config):
Expand Down

0 comments on commit a8a3553

Please sign in to comment.