Debian Codegraph @

test/test_sqlalchemy_postgresql.py

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