diff --git a/.gitignore b/.gitignore index 968f0e66..ee5eac08 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ *.so *.pyd *.gz +.*.sw[a-z] *.zip *.egg *.egg-info/ diff --git a/TESTING.md b/TESTING.md new file mode 100644 index 00000000..a06970c0 --- /dev/null +++ b/TESTING.md @@ -0,0 +1,40 @@ +First, run a little mysql server in your home directory. + +*NOTE:* The below setup is quite insecure and should be shutdown and deleted when testing is concluded. + + mkdir -p ~/tmp/mysqldb-test-server/ + cd !$ + + mysql_install_db --no-defaults --user=$USER --datadir=$PWD/data --socket=$PWD/mysql.sock --force + /usr/sbin/mysqld --no-defaults --user=$USER --datadir=$PWD/data --socket=$PWD/mysql.sock --port 33060 + + +Now edit tests/default.cnf to add the port and change the user to 'root': + + port = 33060 + user = root + + +Install nose: + + pip install nose + + +Populate your new DB with a test table: + + echo 'create database test;' | mysql --port 33060 -h 0.0.0.0 -u root + + +Finally, run the tests: + + cd PATH/TO/MYSQLDB && nosetests + + +When you're done, stop the server: + + cd ~/tmp/mysqldb-test-server && cat data/*.pid | xargs kill + + +Remove its data: + + rm -rf data diff --git a/tests/default.cnf b/tests/default.cnf index 2aeda7cf..d912b13d 100644 --- a/tests/default.cnf +++ b/tests/default.cnf @@ -4,6 +4,7 @@ [MySQLdb-tests] host = 127.0.0.1 +port = 3306 user = test database = test #password =