def test_year_types(self):
specs = [
(mysql.YEAR(), mysql.YEAR(display_width=4)),
- (mysql.YEAR(display_width=2), mysql.YEAR(display_width=2)),
(mysql.YEAR(display_width=4), mysql.YEAR(display_width=4)),
]
)
+ @testing.requires.mysql_zero_date
@testing.provide_metadata
def test_timestamp_nullable(self):
ts_table = Table(
exc.StatementError, set_table.insert().execute,
e1='c', e2='c', e3='c', e4='c')
- @testing.fails_on("+oursql", "oursql raises on the truncate warning")
+ @testing.requires.mysql_non_strict
@testing.provide_metadata
def test_empty_set_no_empty_string(self):
t = Table(
connection.close()
@testing.requires.two_phase_transactions
- @testing.crashes('mysql+oursql',
- 'Times out in full test runs only, causing '
- 'subsequent tests to fail')
- @testing.crashes('mysql+zxjdbc',
- 'Deadlocks, causing subsequent tests to fail')
- @testing.fails_on('mysql', 'FIXME: unknown')
+ @testing.requires.two_phase_recovery
def test_two_phase_recover(self):
# MySQL recovery doesn't currently seem to work correctly
class IndexPropertyJsonTest(fixtures.DeclarativeMappedTest):
+ # TODO: remove reliance on "astext" for these tests
__requires__ = ('json_type',)
+ __only_on__ = 'postgresql'
+
__backend__ = True
@classmethod
relationship(child_mapper,
primaryjoin=relationshipjoin,
foreign_keys=foreign_keys,
+ order_by=child_mapper.c.id,
remote_side=remote_side, uselist=True))
sess = create_session()
exec("%s = testclass" % testclass.__name__)
del testclass
-del produce_test
\ No newline at end of file
+del produce_test
sess = create_session()
def go():
eq_(sess.query(Person)
- .with_polymorphic(Engineer).all(),
+ .with_polymorphic(Engineer).
+ order_by(Person.person_id).all(),
self._emps_wo_relationships_fixture())
self.assert_sql_count(testing.db, go, 3)
.with_polymorphic(
Engineer,
people.outerjoin(engineers))
+ .order_by(Person.person_id)
.all(),
self._emps_wo_relationships_fixture())
self.assert_sql_count(testing.db, go, 3)
'two-phase xact not supported by database'),
])
+ @property
+ def two_phase_recovery(self):
+ return self.two_phase_transactions + (
+ exclusions.fails_if(
+ lambda config: config.db.name == 'mysql' and (
+ 'MariaDB' in config.db.dialect.server_version_info or
+ config.db.dialect.server_version_info < (5, 7)
+ )
+ )
+ )
+
+
@property
def views(self):
"""Target database must support VIEWs."""
def mysql_fully_case_sensitive(self):
return only_if(self._has_mysql_fully_case_sensitive)
+ @property
+ def mysql_zero_date(self):
+ def check(config):
+ row = config.db.execute("show variables like 'sql_mode'").first()
+ return not row or "NO_ZERO_DATE" not in row[1]
+
+ return only_if(check)
+
+ @property
+ def mysql_non_strict(self):
+ def check(config):
+ row = config.db.execute("show variables like 'sql_mode'").first()
+ return not row or "STRICT" not in row[1]
+
+ return only_if(check)
+
def _has_mysql_on_windows(self, config):
return against(config, 'mysql') and \
config.db.dialect._detect_casing(config.db) == 1
users, addresses = self.tables.users, self.tables.addresses
values = {
- addresses.c.email_address: users.c.name,
+ addresses.c.email_address: 'updated',
users.c.name: 'ed2'
}
expected = [
(1, 7, 'x', 'jack@bean.com'),
- (2, 8, 'x', 'ed'),
- (3, 8, 'x', 'ed'),
- (4, 8, 'x', 'ed'),
+ (2, 8, 'x', 'updated'),
+ (3, 8, 'x', 'updated'),
+ (4, 8, 'x', 'updated'),
(5, 9, 'x', 'fred@fred.com')]
self._assert_addresses(addresses, expected)
users, addresses = self.tables.users, self.tables.addresses
values = {
- addresses.c.email_address: users.c.name,
+ addresses.c.email_address: 'updated',
users.c.name: 'ed2'
}
eq_(set(ret.prefetch_cols()), set([users.c.some_update]))
expected = [
- (2, 8, 'ed'),
- (3, 8, 'ed'),
+ (2, 8, 'updated'),
+ (3, 8, 'updated'),
(4, 9, 'fred@fred.com')]
self._assert_addresses(addresses, expected)