I am writing a Python
test class with methods relying on a connection to a MySQL database. The purpose of the test class is to test another class used for simplifying interaction with the same database. The interaction is managed through pymysql
which requires login credentials to a MySQL account.
I am investigating the possibility of automatically creating a MySQL test user on any server when executing the tests. My goal is to be able to install the code as a package and have the tests run with a setup procedure that returns the connection to a database without any involvement from the user.
I am currently only familiar with creating MySQL users through an already existing superuser. The temporary solution is to include a file with login credentials that is read and used by the test module.
I might be that I approach the problem from a completely wrong angle. In general I am trying to test code that executes MySQL commands and commits changes to a database. I am grateful of any tips, ideas or experiences.
Cheers,