storage: tests with Python3 OK
This commit is contained in:
parent
6ae2590f50
commit
f2a737e0a8
4 changed files with 25 additions and 11 deletions
|
@ -1,13 +1,12 @@
|
||||||
|
# loops.classifier.testsetup
|
||||||
"""
|
"""
|
||||||
Set up a loops site for testing.
|
Set up a loops site for testing.
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from zope import component
|
from zope import component
|
||||||
#from zope.app.catalog.interfaces import ICatalog
|
#from zope.catalog.interfaces import ICatalog
|
||||||
#from zope.app.catalog.text import TextIndex
|
#from zope.catalog.text import TextIndex
|
||||||
|
|
||||||
from cybertools.storage.interfaces import IExternalStorage
|
from cybertools.storage.interfaces import IExternalStorage
|
||||||
from cybertools.storage.filesystem import fullPathStorage
|
from cybertools.storage.filesystem import fullPathStorage
|
||||||
|
|
|
@ -3,9 +3,13 @@
|
||||||
"""Comprehensive functional testing for SQL-based storage implementation.
|
"""Comprehensive functional testing for SQL-based storage implementation.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from loops.tests import fixPythonPath
|
||||||
|
fixPythonPath()
|
||||||
|
|
||||||
from loops.storage.tests import common
|
from loops.storage.tests import common
|
||||||
|
|
||||||
import transaction
|
import transaction
|
||||||
|
import unittest
|
||||||
from zope import component
|
from zope import component
|
||||||
from zope.traversing.api import getName
|
from zope.traversing.api import getName
|
||||||
|
|
||||||
|
@ -24,7 +28,7 @@ class TestStorage(common.TestCase):
|
||||||
def test_000_setUp(self):
|
def test_000_setUp(self):
|
||||||
self.prepare()
|
self.prepare()
|
||||||
self.assertEqual(str(self.g.storage.engine.url),
|
self.assertEqual(str(self.g.storage.engine.url),
|
||||||
'postgresql://ccotest:cco@localhost:5432/ccotest')
|
'postgresql+psycopg://ccotest:***@localhost:5432/ccotest')
|
||||||
self.g.storage.dropTable('favorites')
|
self.g.storage.dropTable('favorites')
|
||||||
self.g.storage.dropTable('uid_mapping')
|
self.g.storage.dropTable('uid_mapping')
|
||||||
component.provideAdapter(FavoritesAdapter)
|
component.provideAdapter(FavoritesAdapter)
|
||||||
|
@ -71,6 +75,12 @@ class TestStorage(common.TestCase):
|
||||||
self.cleanup()
|
self.cleanup()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
def test_suite():
|
||||||
unittest.main()
|
return unittest.TestSuite((
|
||||||
|
unittest.makeSuite(TestStorage),
|
||||||
|
))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main(defaultTest='test_suite')
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
"""
|
# loops.tests
|
||||||
$Id$
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
import os.path
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def fixPythonPath(doPrint=False):
|
||||||
|
sys.path = [os.path.dirname(__file__)] + sys.path[1:]
|
||||||
|
if doPrint:
|
||||||
|
print('sys.path =', sys.path)
|
||||||
|
|
|
@ -26,7 +26,7 @@ import cybertools
|
||||||
from cybertools.meta.interfaces import IOptions
|
from cybertools.meta.interfaces import IOptions
|
||||||
from loops.browser.util import html_quote
|
from loops.browser.util import html_quote
|
||||||
|
|
||||||
try: # for testing!
|
try: # avoid error when testing
|
||||||
import config
|
import config
|
||||||
from loops.storage.compat.common import StorageFactory
|
from loops.storage.compat.common import StorageFactory
|
||||||
storageFactory = StorageFactory(config)
|
storageFactory = StorageFactory(config)
|
||||||
|
|
Loading…
Add table
Reference in a new issue