Skip to main content

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. You will need a working MySQL or MariaDB install. It does not have to be running, the binaries are needed.

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

Class arguments

The following class arguments can be overridden by passing them in, these arguments will override the config file arguments.

Argument Description Default
username Username for database root
password Password for database root
host Host to bind 127.0.0.1
port Port to bind random
mysql_install_db_binary Location of mysql_install_db Searches paths
mysqld_binary Location of mysqld Searches paths
timeout_start Timeout to start MySQL 30 seconds
timeout_stop Timeout to stop MySQL 30 seconds
log_level Log level INFO
config_file Configuration file mysqld-integration-test.cfg

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()

Metadata

Release files for mysqld-integration-test 0.0.28

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mysqld-integration-test 0.0.28
File Size Uploaded Provenance
mysqld_integration_test-0.0.28.tar.gz 14.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mysqld-integration-test 0.0.28
File Interpreter ABI Platform
mysqld_integration_test-0.0.28-py3-none-any.whl Python 3 none any Details

Total release size: 27.7 kB

Release files / mysqld_integration_test-0.0.28.tar.gz

Download URL mysqld_integration_test-0.0.28.tar.gz
Size 14.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1f262ed02fe9cf1c86eead98a218735d8eb5fb09563f8bd68e53175dea3435ac
BLAKE2b-256 checksum
How to use checksums
33addba895e13c84d9b38fe44c9b21d19758e3bf19d9b4826020816e35045947
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.5

Release files / mysqld_integration_test-0.0.28-py3-none-any.whl

Download URL mysqld_integration_test-0.0.28-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
86db7905853d3cf9f4cd6a55dae91ba9c79fe970dc277c2ebbf728e87631c4d1
BLAKE2b-256 checksum
How to use checksums
99c8190bd3dde020374d5ac2e3a7ee1244d7f8312c131ff844189f7f059a2806
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.5

Security for mysqld-integration-test 0.0.28

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page