diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8f66966..0f5ddf0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,13 +29,13 @@ jobs: options: --entrypoint redis-server env: - DATABASE_URL: 'postgres://postgres:postgres@127.0.0.1:5432/socket_test' + DATABASE_URL: 'postgresql://postgres:postgres@127.0.0.1:5432/socket_test' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: set up python - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: '3.8' @@ -68,7 +68,7 @@ jobs: HEROKU_APP: tc-socket steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: git fetch --unshallow - run: git switch master - run: git remote add heroku https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP.git diff --git a/tcsocket/app/main.py b/tcsocket/app/main.py index b3ebd64..0f8bef1 100644 --- a/tcsocket/app/main.py +++ b/tcsocket/app/main.py @@ -80,7 +80,7 @@ def setup_routes(app): app.router.add_post(r'/{company}/book-appointment', book_appointment, name='book-appointment') -def create_app(loop, *, settings: Settings = None): +def create_app(*, settings: Settings = None): app = web.Application(middlewares=middleware) settings = settings or Settings() app['settings'] = settings diff --git a/tcsocket/requirements.txt b/tcsocket/requirements.txt index 631165e..9d37f04 100644 --- a/tcsocket/requirements.txt +++ b/tcsocket/requirements.txt @@ -1,4 +1,4 @@ -SQLAlchemy==1.4.40 +sqlalchemy==1.4.38 aiodns==3.0.0 aiohttp==3.8.1 aiopg==1.3.4 diff --git a/tcsocket/run.py b/tcsocket/run.py index d5f30a4..3560b3f 100755 --- a/tcsocket/run.py +++ b/tcsocket/run.py @@ -24,13 +24,16 @@ def cli(verbose): setup_logging(verbose) +async def start_and_stop_app(app): + await app.startup() + await app.cleanup() + + def check_app(): - loop = asyncio.get_event_loop() logger.info("initialising aiohttp app to check it's working...") - app = create_app(loop) + app = create_app() app.freeze() - loop.run_until_complete(app.startup()) - loop.run_until_complete(app.cleanup()) + asyncio.run(start_and_stop_app(app)) del app logger.info('app started and stopped successfully, apparently configured correctly') @@ -62,8 +65,7 @@ def load_config(self): self.cfg.set(k, v) def load(self): - loop = asyncio.get_event_loop() - return create_app(loop) + return create_app() logger.info('starting gunicorn...') Application().run() diff --git a/tests/requirements.txt b/tests/requirements.txt index 223a43b..d7c4ea4 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -7,7 +7,7 @@ pycodestyle==2.9.1 pyflakes==2.5.0 pytest==7.1.2 pytest-aiohttp==1.0.4 -pytest-asyncio==0.18.3 +pytest-asyncio==0.21.0 pytest-cov==3.0.0 pytest-isort==3.0.0 pytest-mock==3.8.2