Feat(CI): Run tests with PostgreSQL
authorOleg Broytman <phd@phdru.name>
Fri, 9 Jun 2017 19:56:41 +0000 (22:56 +0300)
committerOleg Broytman <phd@phdru.name>
Sat, 10 Jun 2017 16:26:40 +0000 (19:26 +0300)
.travis.yml
TODO
appveyor.yml
docs/news.rst
sqlconvert/__version__.py
tox.ini

index 6b5a49e..d1f382b 100644 (file)
@@ -16,11 +16,22 @@ python:
 
 cache: pip
 
+addons:
+  apt:
+    packages:
+      - python-psycopg2
+      - python3-psycopg2
+  postgresql: "9.4"
+
 env:
   - TOXENV=py27
   - TOXENV=py34
   - TOXENV=py35
   - TOXENV=py36
+  - TOXENV=py27-postgres
+  - TOXENV=py34-postgres
+  - TOXENV=py35-postgres
+  - TOXENV=py36-postgres
   - TOXENV=py27-sqlite
   - TOXENV=py34-sqlite
   - TOXENV=py35-sqlite
diff --git a/TODO b/TODO
index 45ff84a..69cd5fa 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,6 +1,3 @@
-Test at Travis and AppVeyor with Postgres.
-
-
 In SQLite/Postgres (non-MySQL) mode:
 
    Replace AUTO_INCREMENT columns with INTEGER PRIMARY KEY for SQLite or
index 80ba5e1..2cc3783 100644 (file)
@@ -16,7 +16,13 @@ cache:
 # Match travis
 clone_depth: 50
 
+services:
+  - postgresql
+
 environment:
+  PGUSER: "postgres"
+  PGPASSWORD: "Password12!"
+
   matrix:
     - PYTHON_HOME: "C:\\Python27"
       PYTHON_VERSION: "2.7"
@@ -50,6 +56,38 @@ environment:
       PYTHON_VERSION: "3.6"
       PYTHON_ARCH: "64"
       TOX_ENV: "py36"
+    - PYTHON_HOME: "C:\\Python27"
+      PYTHON_VERSION: "2.7"
+      PYTHON_ARCH: "32"
+      TOX_ENV: "py27-postgres-w32"
+    - PYTHON_HOME: "C:\\Python27-x64"
+      PYTHON_VERSION: "2.7"
+      PYTHON_ARCH: "64"
+      TOX_ENV: "py27-postgres-w32"
+    - PYTHON_HOME: "C:\\Python34"
+      PYTHON_VERSION: "3.4"
+      PYTHON_ARCH: "32"
+      TOX_ENV: "py34-postgres-w32"
+    - PYTHON_HOME: "C:\\Python34-x64"
+      PYTHON_VERSION: "3.4"
+      PYTHON_ARCH: "64"
+      TOX_ENV: "py34-postgres-w32"
+    - PYTHON_HOME: "C:\\Python35"
+      PYTHON_VERSION: "3.5"
+      PYTHON_ARCH: "32"
+      TOX_ENV: "py35-postgres-w32"
+    - PYTHON_HOME: "C:\\Python35-x64"
+      PYTHON_VERSION: "3.5"
+      PYTHON_ARCH: "64"
+      TOX_ENV: "py35-postgres-w32"
+    - PYTHON_HOME: "C:\\Python36"
+      PYTHON_VERSION: "3.6"
+      PYTHON_ARCH: "32"
+      TOX_ENV: "py36-postgres-w32"
+    - PYTHON_HOME: "C:\\Python36-x64"
+      PYTHON_VERSION: "3.6"
+      PYTHON_ARCH: "64"
+      TOX_ENV: "py36-postgres-w32"
     - PYTHON_HOME: "C:\\Python27"
       PYTHON_VERSION: "2.7"
       PYTHON_ARCH: "32"
@@ -93,7 +131,7 @@ environment:
 
 install:
   # Ensure we use the right python version
-  - "SET PATH=%PYTHON_HOME%;%PYTHON_HOME%\\Scripts;%PATH%"
+  - "SET PATH=%PYTHON_HOME%;%PYTHON_HOME%\\Scripts;C:\\Program Files\\PostgreSQL\\9.5\\bin;%PATH%"
   - "SET TOXPYTHON=%PYTHON_HOME%\\python.exe"
   - "python --version"
   - "python -c \"import struct; print(struct.calcsize('P') * 8)\""
index cc1cca0..72203a6 100644 (file)
@@ -1,6 +1,11 @@
 News
 ====
 
+Version 0.2.2 (2017-06-??)
+--------------------------
+
+* Test at Travis and AppVeyor with Postgres.
+
 Version 0.2.1 (2017-05-01)
 --------------------------
 
index fc79d63..020ed73 100644 (file)
@@ -1 +1 @@
-__version__ = '0.2.1'
+__version__ = '0.2.2'
diff --git a/tox.ini b/tox.ini
index 324f4d1..c360621 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,6 @@
 [tox]
 minversion = 1.8
-envlist = {py27,py34,py35,py36},{py27,py34,py35,py36}-{postgres,sqlite,sqlite-w32},{py27,py34}-flake8
+envlist = {py27,py34,py35,py36},{py27,py34,py35,py36}-{postgres,postgres-w32,sqlite,sqlite-w32},{py27,py34}-flake8
 
 # Base test environment settings
 [testenv]
@@ -15,6 +15,7 @@ commands =
 deps =
     -rdevscripts/requirements/requirements_tests.txt
     postgres: psycopg2
+passenv = PGPASSWORD
 sitepackages = True
 # Don't fail or warn on uninstalled commands
 whitelist_externals =
@@ -46,10 +47,10 @@ commands = {[general]commands}
 [postgresql]
 commands =
     {[testenv]commands}
-    -dropdb test
-    createdb test
-    {envpython} -m pytest --cov=sqlconvert -D postgres:///test
-    dropdb test
+    -dropdb -U postgres -w test
+    createdb -U postgres -w test
+    {envpython} -m pytest --cov=sqlconvert -D postgres://postgres:@localhost/test
+    dropdb -U postgres -w test
 
 [testenv:py27-postgres]
 commands = {[postgresql]commands}
@@ -63,6 +64,26 @@ commands = {[postgresql]commands}
 [testenv:py36-postgres]
 commands = {[postgresql]commands}
 
+[postgres-w32]
+commands =
+    {[testenv]commands}
+    -dropdb -U postgres -w test
+    createdb -U postgres -w test
+    pytest --cov=sqlconvert -D "postgres://postgres:Password12!@localhost/test"
+    dropdb -U postgres -w test
+
+[testenv:py27-postgres-w32]
+commands = {[postgres-w32]commands}
+
+[testenv:py34-postgres-w32]
+commands = {[postgres-w32]commands}
+
+[testenv:py35-postgres-w32]
+commands = {[postgres-w32]commands}
+
+[testenv:py36-postgres-w32]
+commands = {[postgres-w32]commands}
+
 # SQLite test environments
 [sqlite]
 commands =