NoSQL dal tests

This commit is contained in:
Alan Etkin
2014-01-22 08:50:03 -03:00
parent 4cbdf612af
commit 98610df1d4
5 changed files with 1435 additions and 5 deletions
+16
View File
@@ -10,6 +10,7 @@ env:
- DB=sqlite:memory
- DB=mysql://root:@localhost/test_w2p
- DB=postgres://postgres:@localhost/test_w2p
- DB=google:datastore
before_script:
- if [[ $TRAVIS_PYTHON_VERSION != '2.7' ]]; then pip install unittest2; fi
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install coverage; fi;
@@ -18,6 +19,16 @@ before_script:
- if [[ $TRAVIS_PYTHON_VERSION == '2.5' ]]; then pip install pysqlite; fi
- if [[ $DB == mysql* ]]; then mysql -e 'create database test_w2p;'; fi
- if [[ $DB == postgres* ]]; then psql -c 'create database test_w2p;' -U postgres; fi
# Install last sdk for app engine
- if [[ $DB == google* ]]; then wget http://googleappengine.googlecode.com/svn/trunk/python/VERSION -O ./GAEVERSION; fi
- if [[ $DB == google* ]]; then GAERELEASE=$(cat ./GAEVERSION | grep -i release); fi
- if [[ $DB == google* ]]; then GAERELEASE=${GAERELEASE#*\"}; fi
- if [[ $DB == google* ]]; then GAERELEASE=${GAERELEASE%\"}; fi
- if [[ $DB == google* ]]; then wget http://googleappengine.googlecode.com/files/google_appengine_$GAERELEASE.zip -nv; fi
- if [[ $DB == google* ]]; then unzip -q google_appengine_$GAERELEASE.zip; fi
- if [[ $DB == google* ]]; then mv -f ./google_appengine/google ./google; fi
#Temporal solution to travis issue #155
- sudo chmod 777 /dev/shm
- sudo rm -rf /dev/shm && sudo ln -s /run/shm /dev/shm
@@ -27,6 +38,10 @@ matrix:
env: DB=postgres://postgres:@localhost/test_w2p
- python: 'pypy'
env: DB=mysql://root:@localhost/test_w2p
- python: 'pypy'
env: DB=google:datastore
- python: '2.6'
env: DB=google:datastore
script: export COVERAGE_PROCESS_START=gluon/tests/coverage.ini; ./web2py.py --run_system_tests --with_coverage
after_success:
@@ -35,3 +50,4 @@ after_success:
notifications:
email: true
+9 -2
View File
@@ -1,6 +1,13 @@
import os, sys
from test_http import *
from test_cache import *
from test_dal import *
if "google" in os.getenv("DB"):
from test_dal_nosql import *
else:
from test_dal import *
from test_html import *
from test_is_url import *
from test_languages import *
@@ -13,6 +20,6 @@ from test_utils import *
from test_contribs import *
from test_web import *
import sys
if sys.version[:3] == '2.7':
from test_old_doctests import *
+2 -2
View File
@@ -43,12 +43,12 @@ def fix_sys_path():
fix_sys_path()
from dal import DAL, Field, Table, SQLALL
#for travis-ci
DEFAULT_URI = os.environ.get('DB', 'sqlite:memory')
print 'Testing against %s engine (%s)' % (DEFAULT_URI.partition(':')[0], DEFAULT_URI)
from dal import DAL, Field, Table, SQLALL
ALLOWED_DATATYPES = [
'string',
File diff suppressed because it is too large Load Diff
+6 -1
View File
@@ -5,7 +5,10 @@
"""
import sys
import os
import unittest
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
import subprocess
import time
import signal
@@ -94,6 +97,8 @@ class LiveTest(unittest.TestCase):
def tearDownClass(cls):
stopwebserver()
@unittest.skipIf("datastore" in os.getenv("DB", ""), "TODO: setup web test for app engine")
class TestWeb(LiveTest):
def testRegisterAndLogin(self):
client = WebClient('http://127.0.0.1:8000/welcome/default/')