|
| 1 | +"""pg8000 test.""" |
| 2 | +import os |
| 3 | +import unittest |
| 4 | +import logging |
| 5 | +from nose.exc import SkipTest |
| 6 | +from . import context_case |
| 7 | +from . import graph_case |
| 8 | +if os.environ.get('DB') != 'pgsql': |
| 9 | + raise SkipTest("PgSQL not under test") |
| 10 | +try: |
| 11 | + import pg8000 |
| 12 | + assert pg8000 is not None |
| 13 | +except ImportError: |
| 14 | + raise SkipTest("pg8000 not installed, skipping PgSQL tests") |
| 15 | +_logger = logging.getLogger(__name__) |
| 16 | + |
| 17 | +sqlalchemy_url = os.environ.get( |
| 18 | + 'DBURI', |
| 19 | + 'postgresql+pg8000://postgres@localhost/test') |
| 20 | + |
| 21 | + |
| 22 | +class SQLAPgSQLGraphTestCase(graph_case.GraphTestCase): |
| 23 | + """Graph test case.""" |
| 24 | + |
| 25 | + storetest = True |
| 26 | + storename = "SQLAlchemy" |
| 27 | + uri = sqlalchemy_url |
| 28 | + create = True |
| 29 | + |
| 30 | + def setUp(self): |
| 31 | + """Setup.""" |
| 32 | + super(SQLAPgSQLGraphTestCase, self).setUp( |
| 33 | + uri=self.uri, storename=self.storename) |
| 34 | + |
| 35 | + def tearDown(self): |
| 36 | + """Teardown.""" |
| 37 | + super(SQLAPgSQLGraphTestCase, self).tearDown(uri=self.uri) |
| 38 | + |
| 39 | + |
| 40 | +class SQLAPgSQLContextTestCase(context_case.ContextTestCase): |
| 41 | + """Context test case.""" |
| 42 | + |
| 43 | + storetest = True |
| 44 | + storename = "SQLAlchemy" |
| 45 | + uri = sqlalchemy_url |
| 46 | + create = True |
| 47 | + |
| 48 | + def setUp(self): |
| 49 | + """Setup.""" |
| 50 | + super(SQLAPgSQLContextTestCase, self).setUp( |
| 51 | + uri=self.uri, storename=self.storename) |
| 52 | + |
| 53 | + def tearDown(self): |
| 54 | + """Teardown.""" |
| 55 | + super(SQLAPgSQLContextTestCase, self).tearDown(uri=self.uri) |
| 56 | + |
| 57 | + def testLenInMultipleContexts(self): |
| 58 | + """Test lin in multiple contexts, known issue.""" |
| 59 | + raise SkipTest("Known issue.") |
| 60 | + |
| 61 | +# SQLAPgSQLGraphTestCase.storetest = True |
| 62 | +# SQLAPgSQLContextTestCase.storetest = True |
| 63 | + |
| 64 | +if __name__ == '__main__': |
| 65 | + unittest.main() |
0 commit comments