Developement — Python MySQL Replication 0.18 documentation (original) (raw)

Tests

When it’s possible we have an unit test.

pymysqlreplication/tests/ contains the test suite. The test suite use the standard unittest Python module.

Be carefull tests will reset the binary log of your MySQL server.

Make sure you have the following configuration set in your mysql config file (usually my.cnf on development env):

log-bin=mysql-bin server-id=1 binlog-format = row #Very important if you want to receive write, update and delete row events gtid_mode=ON log-slave_updates=true enforce_gtid_consistency

Run tests with

py.test -k "not test_no_trailing_rotate_event"

This will skip the test_no_trailing_rotate_event which requires that the user running the test have permission to alter the binary log files.

Running mysql in docker (main):

docker run --name python-mysql-replication-tests -e MYSQL_ALLOW_EMPTY_PASSWORD=true -p 3306:3306 --rm percona:latest --log-bin=mysql-bin.log --server-id 1 --binlog-format=row --gtid_mode=on --enforce-gtid-consistency=on --log_slave_updates

Running mysql in docker (for ctl server):

docker run --name python-mysql-replication-tests-ctl --expose=3307 -e MYSQL_ALLOW_EMPTY_PASSWORD=true -p 3307:3307 --rm percona:latest --log-bin=mysql-bin.log --server-id 1 --binlog-format=row --gtid_mode=on --enforce-gtid-consistency=on --log_slave-updates -P 3307

Each pull request is tested on Travis CI:https://travis-ci.org/noplay/python-mysql-replication

Build the documentation

The documentation is available in docs folder. You can build it using Sphinx:

cd docs pip install sphinx make html