Ejemplo n.º 1
0
import testenv; testenv.configure_for_tests()
import unittest

import orm.alltests as orm
import base.alltests as base
import sql.alltests as sql
import engine.alltests as engine
import dialect.alltests as dialect
import ext.alltests as ext
import zblog.alltests as zblog
import profiling.alltests as profiling

# The profiling tests are sensitive to foibles of CPython VM state, so
# run them first.  Ideally, each should be run in a fresh interpreter.

def suite():
    alltests = unittest.TestSuite()
    for suite in (profiling, base, engine, sql, dialect, orm, ext, zblog):
        alltests.addTest(suite.suite())
    return alltests


if __name__ == '__main__':
    testenv.main(suite())
Ejemplo n.º 2
0
import testenv
testenv.configure_for_tests()
from testlib import sa_unittest as unittest


def suite():
    modules_to_test = (
        # core utilities
        'base.dependency',
        'base.utils',
        'base.except',
    )
    alltests = unittest.TestSuite()
    for name in modules_to_test:
        mod = __import__(name)
        for token in name.split('.')[1:]:
            mod = getattr(mod, token)
        alltests.addTest(unittest.findTestCases(mod, suiteClass=None))
    return alltests


if __name__ == '__main__':
    testenv.main(suite())
Ejemplo n.º 3
0
import testenv; testenv.configure_for_tests()
from testlib import sa, testing
from testlib.sa.util import OrderedSet
from testlib.sa.orm import mapper, relation, create_session, PropComparator, synonym, comparable_property
from testlib.testing import eq_, ne_
from orm import _base, _fixtures


class MergeTest(_fixtures.FixtureTest):
    """Session..merge() functionality"""

    run_inserts = None

    def on_load_tracker(self, cls, canary=None):
        if canary is None:
            def canary(instance):
                canary.called += 1
            canary.called = 0

        manager = sa.orm.attributes.manager_of_class(cls)
        manager.events.add_listener('on_load', canary)

        return canary

    @testing.resolve_artifact_names
    def test_transient_to_pending(self):
        mapper(User, users)
        sess = create_session()
        on_load = self.on_load_tracker(User)
Ejemplo n.º 4
0
# coding: utf-8
"""verrrrry basic unicode column name testing"""

import testenv

testenv.configure_for_tests()
from sqlalchemy import *
from testlib import *
from testlib.engines import utf8_engine
from sqlalchemy.sql import column


class UnicodeSchemaTest(TestBase):
    __requires__ = ("unicode_ddl",)

    def setUpAll(self):
        global unicode_bind, metadata, t1, t2, t3

        unicode_bind = utf8_engine()

        metadata = MetaData(unicode_bind)
        t1 = Table(
            "unitable1",
            metadata,
            Column(u"méil", Integer, primary_key=True),
            Column(u"\u6e2c\u8a66", Integer),
            test_needs_fk=True,
        )
        t2 = Table(
            u"Unitéble2",
            metadata,