tortoise / tortoise/tortoise-orm

#Question How to setup tortoise for Sanic application in pytest?

Open
#1,395 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Python
Stars
5.6k
Forks
516
Avg merge
2d 21h
Merged PRs (30d)
9

Description

Im trying to use sanic-testing but when i try to make Tortoise.init() for my test db (e.g. sqlite:///:memory) in listener or other fixture i have exceptions.

How can i setup tortoise orm for sanic app to make it work and test my crud application? (fixture with scope='session', autouser=True didnt work)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing Tortoise.init() with sanic-testing, an in-memory SQLite database, and the listener or fixture setup described in the issue. Use the resulting exceptions to investigate a working pytest fixture for the Sanic CRUD application; done means the test database initializes and CRUD tests run successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlite
Domain
backend, databases, testing
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.