mysqld-integration-test is a python module that creates a temporary mysqld instance to use for testing your application.
Project description
mysqld-integration-test
Overview
mysqld-integration-test is a python module that creates a temporary mysqld instance to use for testing your application. It is based on the testing.mysqld
module which has not been updated recently.
Download and Install
To install use pip:
$ pip install mysqld-integration-test
Or clone the repo:
$ git clone https://github.com/jasondcamp/mysqld-integration-test.git
Configuration
mysqld-integration-test config file
Default settings can be overridden in a config file. The default name is mysqld-integration-test.cfg
in the local directory and can be overridden by passing in the config
option to the instance creation.
Example config
database:
host: '127.0.0.1'
port: '9999'
username: 'root'
password: 'test'
mysql_install_db_binary: '/usr/local/bin/mysql_install_db'
mysqld_binary: '/usr/sbin/mysqld'
general:
log_level: 'DEBUG'
timeout_start: 30
timeout_stop: 30
Usage
import
from mysqld_integration_test import Mysqld
run
Starts up the mysql server
mysqld = Mysqld()
instance = mysqld.run()
stop
Stops the mysql server
mysqld.stop()
Example Code
#!/usr/bin/env python3
from mysqld_integration_test import Mysqld
import mysql.connector
mysqld = Mysqld(config='/some/dir/mysqld-integration-test.cfg')
instance = mysqld.run()
# Make query to database
cnx = mysql.connector.connect(user=instance.username, password=instance.password,
host=instance.host, port=instance.port)
cursor = cnx.cursor()
cursor.execute(f"SHOW databases;")
for db in cursor:
print(db[0])
cursor.close()
cnx.close()
mysqld.stop()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for mysqld-integration-test-0.0.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bb558eadcfa71ef12b39fe273c16feba5a7a0a054187a78e965712e39fea4ef |
|
MD5 | a76f810e45a12a1cdb7cec5750a95a4f |
|
BLAKE2b-256 | fd3beb79d484a63b92e2eb3c0eee6b987dfd68a03b46780bcd68aaca22dca7fa |
Close
Hashes for mysqld_integration_test-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4603633952a6fbf7ab9adb405ba7e13ae10c877e25f53b1b1bba7ea8f326a157 |
|
MD5 | 29c0b3bf064132eaeba82af037099af3 |
|
BLAKE2b-256 | 55c85136ef3637ec0af001e637966190729330bae35a62d1c05ae8bd7394254f |