Testing python applications using mysql

I want to write some unittests for an application that uses MySQL. However, I do not want to connect to a real mysql database, but rather to a temporary one, which does not require any SQL server at all.

Any library (I didn't find anything on Google)? Any design template? Please note that DIP does not work, since I still have to test the introduced class.

+5
source share
2 answers

There is no good way to do this. You want to run your queries on a real MySQL server, otherwise you do not know whether they will work or not.

, . , Unit Test, . , , - .

+8

python-mock mox ( , SQL-), / MySQL .

, SQLite SQL MySQL , , ORM (Django, SQLObject, SQLAlchemy,...), .

+4

All Articles