fix for StorageList and tests added
gluon/storage.py StorageList had a recursion error (please check the implementation before committing) gluon/tests* added the fix_path module to avoid those ugly lines at the beginning of each test file added tests for gluon.contenttype and test_fileutils added tests for missing Storage methods
This commit is contained in:
+5
-30
@@ -15,40 +15,17 @@ try:
|
||||
except:
|
||||
from io import StringIO
|
||||
|
||||
def fix_sys_path():
|
||||
"""
|
||||
logic to have always the correct sys.path
|
||||
'', web2py/gluon, web2py/site-packages, web2py/ ...
|
||||
"""
|
||||
from fix_path import fix_sys_path
|
||||
|
||||
def add_path_first(path):
|
||||
sys.path = [path] + [p for p in sys.path if (
|
||||
not p == path and not p == (path + '/'))]
|
||||
|
||||
path = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
if not os.path.isfile(os.path.join(path,'web2py.py')):
|
||||
i = 0
|
||||
while i<10:
|
||||
i += 1
|
||||
if os.path.exists(os.path.join(path,'web2py.py')):
|
||||
break
|
||||
path = os.path.abspath(os.path.join(path, '..'))
|
||||
|
||||
paths = [path,
|
||||
os.path.abspath(os.path.join(path, 'site-packages')),
|
||||
os.path.abspath(os.path.join(path, 'gluon')),
|
||||
'']
|
||||
[add_path_first(path) for path in paths]
|
||||
|
||||
fix_sys_path()
|
||||
fix_sys_path(__file__)
|
||||
|
||||
#for travis-ci
|
||||
DEFAULT_URI = os.environ.get('DB', 'sqlite:memory')
|
||||
DEFAULT_URI = os.getenv('DB', 'sqlite:memory')
|
||||
|
||||
print 'Testing against %s engine (%s)' % (DEFAULT_URI.partition(':')[0], DEFAULT_URI)
|
||||
|
||||
from dal import DAL, Field, Table, SQLALL
|
||||
from gluon.cache import CacheInRam
|
||||
|
||||
ALLOWED_DATATYPES = [
|
||||
'string',
|
||||
@@ -564,9 +541,8 @@ class TestMinMaxSumAvg(unittest.TestCase):
|
||||
db.tt.drop()
|
||||
|
||||
|
||||
class TestSelectCache(unittest.TestCase):
|
||||
class TestCacheSelect(unittest.TestCase):
|
||||
def testRun(self):
|
||||
from cache import CacheInRam
|
||||
cache = CacheInRam()
|
||||
db = DAL(DEFAULT_URI, check_reserved=['all'])
|
||||
db.define_table('tt', Field('aa'))
|
||||
@@ -1459,7 +1435,6 @@ class TestQuoting(unittest.TestCase):
|
||||
db._adapter.types[key]=db._adapter.types[key].replace(
|
||||
'%(on_delete_action)s','NO ACTION')
|
||||
|
||||
|
||||
t0 = db.define_table('t0',
|
||||
Field('f', 'string'))
|
||||
t1 = db.define_table('b',
|
||||
|
||||
Reference in New Issue
Block a user