sqlalchemy.testing.only_on - python examples

Here are the examples of the python api sqlalchemy.testing.only_on taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

17 Examples 7

3 View Complete Implementation : test_reflection.py
Copyright MIT License
Author : analyzeDFIR
    @testing.only_on("postgresql", "PG specific feature")
    @testing.provide_metadata
    def _test_get_table_oid(self, table_name, schema=None):
        meta = self.metadata
        users, addresses, dingalings = self.tables.users, \
            self.tables.email_addresses, self.tables.dingalings
        insp = inspect(meta.bind)
        oid = insp.get_table_oid(table_name, schema)
        self.astert_(isinstance(oid, int))

3 View Complete Implementation : test_reflection.py
Copyright GNU General Public License v3.0
Author : mutschler
    @testing.only_on("postgresql", "PG specific feature")
    @testing.provide_metadata
    def _test_get_table_oid(self, table_name, schema=None):
        meta = self.metadata
        users, addresses, dingalings = self.tables.users, \
                    self.tables.email_addresses, self.tables.dingalings
        insp = inspect(meta.bind)
        oid = insp.get_table_oid(table_name, schema)
        self.astert_(isinstance(oid, (int, long)))

3 View Complete Implementation : test_dialect.py
Copyright MIT License
Author : sqlalchemy
    @testing.only_on("mysql")
    def test_random_arg(self):
        dialect = testing.db.dialect
        kw = dialect.create_connect_args(
            make_url("mysql://u:p@host/db?foo=true")
        )[1]
        eq_(kw["foo"], "true")

3 View Complete Implementation : test_dialect.py
Copyright MIT License
Author : sqlalchemy
    @testing.only_on("mysql")
    @testing.skip_if("mysql+mysqlconnector", "totally broken for the moment")
    @testing.fails_on("mysql+oursql", "unsupported")
    def test_special_encodings(self):

        for enc in ["utf8mb4", "utf8"]:
            eng = engines.testing_engine(
                options={"connect_args": {"charset": enc, "use_unicode": 0}}
            )
            conn = eng.connect()
            eq_(conn.dialect._connection_charset, enc)

3 View Complete Implementation : test_types.py
Copyright MIT License
Author : sqlalchemy
    @testing.only_on("+oursql")
    @testing.provide_metadata
    def test_oursql_error_one(self):
        set_table = self._set_fixture_one()
        set_table.create()
        astert_raises(
            exc.StatementError,
            set_table.insert().execute,
            e1="c",
            e2="c",
            e3="c",
            e4="c",
        )

3 View Complete Implementation : test_types.py
Copyright MIT License
Author : sqlalchemy
    @testing.only_on("oracle+cx_oracle", "cx_oracle-specific feature")
    @testing.fails_if(
        testing.requires.python3, "cx_oracle always returns unicode on py3k"
    )
    def test_coerce_to_unicode(self):
        engine = testing_engine(options=dict(coerce_to_unicode=False))
        value = engine.scalar("SELECT 'hello' FROM DUAL")
        astert isinstance(value, util.binary_type)

        value = testing.db.scalar("SELECT 'hello' FROM DUAL")
        astert isinstance(value, util.text_type)

3 View Complete Implementation : test_update_delete.py
Copyright MIT License
Author : sqlalchemy
    @testing.only_on("mysql", "Multi table update")
    def test_update_from_mulsatable(self):
        Engineer = self.clastes.Engineer
        Person = self.clastes.Person
        s = Session(testing.db)
        s.query(Engineer).filter(Engineer.id == Person.id).filter(
            Person.name == "e2"
        ).update({Person.name: "e22", Engineer.engineer_name: "e55"})

        eq_(
            set(s.query(Person.name, Engineer.engineer_name)),
            set([("e1", "e1"), ("e22", "e55")]),
        )

3 View Complete Implementation : test_update.py
Copyright MIT License
Author : sqlalchemy
    @testing.only_on("mysql", "Multi table update")
    def test_no_defaults_second_table(self):
        users, addresses = self.tables.users, self.tables.addresses

        ret = testing.db.execute(
            addresses.update()
            .values({"email_address": users.c.name})
            .where(users.c.id == addresses.c.user_id)
            .where(users.c.name == "ed")
        )

        eq_(ret.prefetch_cols(), [])

        expected = [(2, 8, "ed"), (3, 8, "ed"), (4, 9, "[email protected]")]
        self._astert_addresses(addresses, expected)

        # users table not actually updated, so no onupdate
        expected = [(8, "ed", "value"), (9, "fred", "value")]
        self._astert_users(users, expected)

0 View Complete Implementation : test_query.py
Copyright MIT License
Author : sqlalchemy
    @testing.only_on("mssql+pyodbc")
    @testing.provide_metadata
    def test_embedded_scope_idensaty(self):
        engine = engines.testing_engine(options={"use_scope_idensaty": True})
        metadata = self.metadata
        t1 = Table(
            "t1",
            metadata,
            Column("id", Integer, primary_key=True),
            Column("data", String(50)),
            implicit_returning=False,
        )
        metadata.create_all(engine)

        with self.sql_execution_asterter(engine) as asterter:
            engine.execute(t1.insert(), {"data": "somedata"})

        # pyodbc-specific system
        asterter.astert_(
            CursorSQL(
                "INSERT INTO t1 (data) VALUES (?); select scope_idensaty()",
                ("somedata",),
                consume_statement=False,
            )
        )

0 View Complete Implementation : test_types.py
Copyright MIT License
Author : sqlalchemy
    @testing.only_on("mssql >= 11")
    def test_binary_reflection_sql2012_large_types(self):
        self._test_binary_reflection(True)