Don't use separate databases for tests

I got this wrong: I thought parallel test ran in the same VM; they are
isolated instead.
This commit is contained in:
Daniele Varrazzo 2016-12-24 04:42:07 +01:00
parent 1463bdb86d
commit feebc8f689
3 changed files with 8 additions and 18 deletions

View File

@ -7,19 +7,18 @@ language: python
python:
- 2.7
- 3.6-dev
- 3.5
- 2.6
- 3.5
- 3.4
- 3.3
- 3.2
install:
- python setup.py install
- sudo scripts/travis_prepare.sh
script:
- sudo scripts/travis_prepare.sh
- scripts/travis_test.sh
notifications:
email: false

View File

@ -20,17 +20,19 @@ set_param () {
create () {
version=$1
port=$2
dbname=psycopg2_test_$port
dbname=psycopg2_test
pg_createcluster -p $port --start-conf manual $version psycopg
set_param "$version" max_prepared_transactions 10
sed -i "s/local\s*all\s*postgres.*/local all postgres trust/" \
"/etc/postgresql/$version/psycopg/pg_hba.conf"
pg_ctlcluster "$version" psycopg start
sudo -u postgres psql -c "create user travis" "port=$port"
sudo -u postgres psql -c "create database $dbname" "port=$port"
sudo -u postgres psql -c "grant create on database $dbname to travis" "port=$port"
sudo -u postgres psql -c "create extension hstore" "port=$port dbname=$dbname"
}
# Would give a permission denied error in the travis build dir
cd /

View File

@ -8,18 +8,7 @@ set -e
run_test () {
version=$1
port=$2
pyver=$(python -c "import sys; print(''.join(map(str,sys.version_info[:2])))")
dbname=psycopg_test_$pyver
# Create a database for each python version to allow tests to run in parallel
psql -c "create database $dbname" \
"user=postgres port=$port dbname=postgres"
psql -c "grant create on database $dbname to travis" \
"user=postgres port=$port dbname=postgres"
psql -c "create extension hstore" \
"user=postgres port=$port dbname=$dbname"
dbname=psycopg2_test
printf "\n\nRunning tests against PostgreSQL $version\n\n"
export PSYCOPG2_TESTDB=$dbname