Debian Codegraph @

test/test_sqlalchemy_postgresql_pg8000.py

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