@stop_test_class_outside_fixtures.for_db("oracle")
def stop_test_class_outside_fixtures(config, db, cls):
- with db.begin() as conn:
- # run magic command to get rid of identity sequences
- # https://floo.bar/2019/11/29/drop-the-underlying-sequence-of-an-identity-column/ # noqa E501
- conn.exec_driver_sql("purge recyclebin")
+ try:
+ with db.begin() as conn:
+ # run magic command to get rid of identity sequences
+ # https://floo.bar/2019/11/29/drop-the-underlying-sequence-of-an-identity-column/ # noqa E501
+ conn.exec_driver_sql("purge recyclebin")
+ except exc.DatabaseError as err:
+ log.warning("purge recyclebin command failed: %s", err)
# clear statement cache on all connections that were used
# https://github.com/oracle/python-cx_Oracle/issues/519
"""
- with mapperlib._CONFIGURE_MUTEX:
- all_regs = mapperlib._all_registries()
- mapperlib._dispose_registries(all_regs, False)
+ mapperlib._dispose_registries(mapperlib._all_registries(), False)
joinedload = strategy_options.joinedload._unbound_fn
self._new_mappers = False
- mapperlib._mapper_registries[self] = True
+ with mapperlib._CONFIGURE_MUTEX:
+ mapperlib._mapper_registries[self] = True
@property
def mappers(self):
def _all_registries():
- return set(_mapper_registries)
+ with _CONFIGURE_MUTEX:
+ return set(_mapper_registries)
def _unconfigured_mappers():
- for reg in _mapper_registries:
+ for reg in _all_registries():
for mapper in reg._mappers_to_configure():
yield mapper
"""
- _configure_registries(set(_mapper_registries), cascade=True)
+ _configure_registries(_all_registries(), cascade=True)
def _configure_registries(registries, cascade):
"t2", m, Column("foo", NullType().with_variant(datatype, "oracle"))
)
t3 = Table("t3", m, Column("foo", TestTypeDec()))
- m.create_all(testing.db)
class CursorWrapper(object):
# cx_oracle cursor can't be modified so we have to
else:
engine = testing.db
- with engine.begin() as conn:
+ with engine.connect() as conn:
+ conn.begin()
+
+ m.create_all(conn, checkfirst=False)
+
connection_fairy = conn.connection
for tab in [t1, t2, t3]:
with mock.patch.object(