File: test_sqlalchemy_postgresql_pg8000.py

package info (click to toggle)
rdflib-sqlalchemy 0.5.4%2Bgit99f4689-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,544 kB
  • sloc: python: 2,418; sh: 20; makefile: 3
file content (72 lines) | stat: -rw-r--r-- 1,706 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
"""pg8000 test."""
import logging
import os
import unittest

import pytest
try:
    import pg8000
    assert pg8000 is not None
except ImportError:
    pytest.skip("pg8000 not installed, skipping PgSQL tests",
            allow_module_level=True)

from . import context_case
from . import graph_case


if os.environ.get("DB") != "pgsql":
    pytest.skip("PgSQL not under test", allow_module_level=True)

_logger = logging.getLogger(__name__)

sqlalchemy_url = os.environ.get(
    "DBURI",
    "postgresql+pg8000://postgres@localhost/test")


class SQLAPgSQLGraphTestCase(graph_case.GraphTestCase):
    """Graph test case."""

    storetest = True
    storename = "SQLAlchemy"
    uri = sqlalchemy_url
    create = True

    def setUp(self):
        """Setup."""
        super(SQLAPgSQLGraphTestCase, self).setUp(
            uri=self.uri, storename=self.storename)

    def tearDown(self):
        """Teardown."""
        super(SQLAPgSQLGraphTestCase, self).tearDown(uri=self.uri)


class SQLAPgSQLContextTestCase(context_case.ContextTestCase):
    """Context test case."""

    storetest = True
    storename = "SQLAlchemy"
    uri = sqlalchemy_url
    create = True

    def setUp(self):
        """Setup."""
        super(SQLAPgSQLContextTestCase, self).setUp(
            uri=self.uri, storename=self.storename)

    def tearDown(self):
        """Teardown."""
        super(SQLAPgSQLContextTestCase, self).tearDown(uri=self.uri)

    def testLenInMultipleContexts(self):
        """Test lin in multiple contexts, known issue."""
        pytest.skip("Known issue.")

# SQLAPgSQLGraphTestCase.storetest = True
# SQLAPgSQLContextTestCase.storetest = True


if __name__ == "__main__":
    unittest.main()