mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 09:24:07 +03:00
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:
parent
1463bdb86d
commit
feebc8f689
|
@ -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
|
||||
|
|
|
@ -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 /
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user