summaryrefslogtreecommitdiff
path: root/test/profiling/compiler.py
blob: 58533f70079c3b8a3e391926d8be68a182094932 (plain)
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
import testenv; testenv.configure_for_tests()
from sqlalchemy import *
from testlib import *


class CompileTest(AssertMixin):
    def setUpAll(self):
        global t1, t2, metadata
        metadata = MetaData()
        t1 = Table('t1', metadata,
            Column('c1', Integer, primary_key=True),
            Column('c2', String(30)))

        t2 = Table('t2', metadata,
            Column('c1', Integer, primary_key=True),
            Column('c2', String(30)))

    @profiling.profiled('ctest_insert', call_range=(40, 50), always=True)
    def test_insert(self):
        t1.insert().compile()

    @profiling.profiled('ctest_update', call_range=(40, 50), always=True)
    def test_update(self):
        t1.update().compile()

    # TODO: this is alittle high
    @profiling.profiled('ctest_select', call_range=(110, 140), always=True)
    def test_select(self):
        s = select([t1], t1.c.c2==t2.c.c1)
        s.compile()


if __name__ == '__main__':
    testenv.main()