Commit Graph

127 Commits

Author SHA1 Message Date
Mike Bayer c450cd6cb6 - Fixed regression where using a `functools.partial()` with the event
system would cause a recursion overflow due to usage of inspect.getargspec()
on it in order to detect a legacy calling signature for certain events,
and apparently there's no way to do this with a partial object.  Instead
we skip the legacy check and assume the modern style; the check itself
now only occurs for the SessionEvents.after_bulk_update and
SessionEvents.after_bulk_delete events.  Those two events will require
the new signature style if assigned to a "partial" event listener.
[ticket:2905]
2014-01-04 00:35:48 -05:00
Mike Bayer 2692238f45 - Improvements to the system by which SQL types generate within
``__repr__()``, particularly with regards to the MySQL integer/numeric/
character types which feature a wide variety of keyword arguments.
The ``__repr__()`` is important for use with Alembic autogenerate
for when Python code is rendered in a migration script.
[ticket:2893]
2013-12-18 18:26:15 -05:00
Mike Bayer 3d4d933329 - add support for removal of instance methods as event listeners, taking
into account the id() of the function itself and self, [ticket:2832]
2013-10-01 12:14:34 -04:00
Mike Bayer 9769628ac1 - add WeakSequence.append()
- fix and test weakref cleanout for WeakSequence, [ticket:2794]
2013-08-18 16:05:38 -04:00
Mike Bayer 4505425a38 - Removal of event listeners is now implemented. The feature is
provided via the :func:`.event.remove` function.
[ticket:2268]
- reorganization of event.py module into a package; with the addition of the
docstring work as well as the new registry for removal, there's a lot more code now.
the package separates concerns and provides a top-level doc for each subsection
of functionality
- the remove feature works by providing the EventKey object which associates
the user-provided arguments to listen() with a global, weak-referencing registry.
This registry stores a collection of _ListenerCollection and _DispatchDescriptor
objects associated with each set of arguments, as well as the wrapped function
which was applied to that collection.  The EventKey can then be recreated for
a removal, all the _ListenerCollection and _DispatchDescriptor objects are located,
and the correct wrapped function is removed from each one.
2013-07-26 14:21:58 -04:00
Mike Bayer 02a81707dc - create a new system where we can decorate an event method
with @_legacy_signature, will inspect incoming listener functions
to see if they match an older signature, will wrap into a newer sig
- add an event listen argument named=True, will send all args as
kw args so that event listeners can be written with **kw, any combination
of names
- add a doc system to events that writes out the various calling styles
for a given event, produces deprecation messages automatically.
a little concerned that it's a bit verbose but will look at it up
on RTD for awhile to get a feel.
- change the calling signature for bulk update/delete events - we have
the BulkUD object right there, and there's at least six or seven things
people might want to see, so just send the whole BulkUD in
[ticket:2775]
2013-07-08 13:39:56 -04:00
Mike Bayer b38a76cd1d - replace most explicitly-named test objects called "Mock..." with
actual mock objects from the mock library.  I'd like to use mock
for new tests so we might as well use it in obvious places.
- use unittest.mock in py3.3
- changelog
- add a note to README.unittests
- add tests_require in setup.py
- have tests import from sqlalchemy.testing.mock
- apply usage of mock to one of the event tests.  we can be using
this approach all over the place.
2013-06-30 18:35:12 -04:00
Mike Bayer 0d9ec9fe84 remove all remaining start/end py2k/py3k blocks 2013-06-07 17:51:12 -04:00
Mike Bayer 6e99c0b04e merge default 2013-05-23 13:02:33 -04:00
Mike Bayer 2eaae08f48 Fixed a bug where the routine to detect the correct kwargs
being sent to :func:`.create_engine` would fail in some cases,
such as with the Sybase dialect.
[ticket:2732]
2013-05-23 12:59:53 -04:00
Mike Bayer 8be6831f8b base 2013-05-04 16:00:05 -04:00
Mike Bayer 4b614b9b35 - the raw 2to3 run
- went through examples/ and cleaned out excess list() calls
2013-04-27 19:53:57 -04:00
Mike Bayer 576224edd0 - add workaround for sqlite memusage tests, so no longer need to count to 220/skip tests
- Fixed potential memory leak which could occur if an
arbitrary number of :class:`.sessionmaker` objects
were created.   The anonymous subclass created by
the sessionmaker, when dereferenced, would not be garbage
collected due to remaining class-level references from the
event package.  This issue also applies to any custom system
that made use of ad-hoc subclasses in conjunction with
an event dispatcher.  Also in 0.7.10. [ticket:2650]
2013-01-12 17:21:35 -05:00
Diana Clarke 40071dbda4 initializing _labels to an empty list so that the other methods don't throw exceptions in the None labels case, but rather return (), [], or {}. this is not backwards compatible, but doubt anyone is relying on those exceptions #2601 2012-11-17 15:28:50 -05:00
Diana Clarke dbdd0fdd48 adding _fields, _asdict() to KeyedTuple #2601 2012-11-17 14:55:26 -05:00
Diana Clarke e469529a1d adding tests for KeyedTuple, pep8 pass 2012-11-17 09:51:12 -05:00
Diana Clarke 8a4ab8a4db oops! python 3 doesn't do the rich comparison cmp thing 2012-11-14 23:25:09 -05:00
Diana Clarke f0e19297ee __sub__ was declared twice, just increasing test coverage before I change anything 2012-11-13 18:51:35 -05:00
Mike Bayer 20cdc64588 trying different approaches to test layout. in this one, the testing modules
become an externally usable package but still remains within the main sqlalchemy parent package.
in this system, we use kind of an ugly hack to get the noseplugin imported outside of the
"sqlalchemy" package, while still making it available within sqlalchemy for usage by
third party libraries.
2012-09-27 02:37:33 -04:00
Mike Bayer e5accce97b - repair bool() for instance level event listener where events are classlevel, continuing [ticket:2516] 2012-09-20 12:03:24 -04:00
Mike Bayer 28bfc3d5df - [feature] The before_cursor_execute event
fires off for so-called "_cursor_execute"
    events, which are usually special-case
   executions of primary-key bound sequences
    and default-generation SQL
    phrases that invoke separately when RETURNING
    is not used with INSERT.  [ticket:2459]
2012-08-23 15:40:09 -04:00
Mike Bayer 22ba1c43b7 -whitespace bonanza, contd 2012-07-28 17:05:50 -04:00
Mike Bayer ce9a702dbd - express most of the orm.util functions in terms of the inspection system
- modify inspection system:
	1. raise a new exception for any case where the inspection
        context can't be returned.  this supersedes the "not mapped"
        errors.
        2. don't configure mappers on a mapper inspection.  this allows
        the inspectors to be used during mapper config time.  instead,
        the mapper configures on "with_polymorphic_selectable" now,
        which is needed for all queries
- add a bunch of new "is_XYZ" attributes to inspectors
- finish making the name change of "compile" -> "configure", for some reason
this was only done partially
2012-07-16 17:29:02 -04:00
Mike Bayer c5f8241006 remove WeakIdentityMapping tests 2012-06-24 02:29:08 -04:00
Mike Bayer 4009894100 - [feature] Dramatic improvement in memory
usage of the event system; instance-level
collections are no longer created for a
particular type of event until
instance-level listeners are established
for that event.  [ticket:2516] Also in 0.7.9.
2012-06-20 18:55:13 -04:00
Mike Bayer 232dcbfb19 fix 2.5 failure 2012-04-24 19:55:43 -04:00
Mike Bayer 54017d9de2 merge patch for [ticket:2208]. This still needs documentation. 2012-04-23 12:03:54 -04:00
Mike Bayer ff0fb31bf2 - merge attribute flag overhaul for [ticket:2358] 2012-04-23 11:45:06 -04:00
Mike Bayer f1bdd4e4bb begin implementing inspection system for #2208 2012-04-03 18:53:39 -04:00
Mike Bayer 8696a45b09 - [bug] Fixed event registration bug
which would primarily show up as
events not being registered with
sessionmaker() instances created
after the event was associated
with the Session class.  [ticket:2424]
2012-03-07 22:36:22 -05:00
Mike Bayer a8dc787ff0 - [feature] IdentitySet supports the - operator
as the same as difference(), handy when dealing
with Session.dirty etc. [ticket:2301]
2011-12-06 13:22:59 -05:00
Mike Bayer 127c48252e - Fixed bug in unit of work whereby detection of
"cycles" among classes in highly interlinked patterns
    would not produce a deterministic
    result; thereby sometimes missing some nodes that
    should be considered cycles and causing further
    issues down the road.  Note this bug is in 0.6
    also; not backported at the moment.
    [ticket:2282]
2011-09-22 19:21:39 -04:00
Mike Bayer 9b33b23a13 who knew we already had a test for that 2011-08-22 11:26:52 -04:00
Mike Bayer 3daae3e5b6 - Added an improved repr() to TypeEngine objects
that will only display constructor args which
are positional or kwargs that deviate
from the default.  [ticket:2209]
2011-07-04 13:56:17 -04:00
Mike Bayer 0b52a5ae74 - Added @event.listens_for() decorator, given
target + event name, applies the decorated
function as a listener.  [ticket:2106]
- remove usage of globals from test.base.test_events
2011-04-02 13:29:11 -04:00
Mike Bayer 7b24e458c7 - move all the comments that got shoved below the fixture grabs back up 2011-03-27 17:19:00 -04:00
Mike Bayer 68a350d462 - remove test.sql._base, test.engine._base, test.orm._base, move those classes to a new test.lib.fixtures module
- move testing.TestBase to test.lib.fixtures
- massive search and replace
2011-03-27 16:27:27 -04:00
Mike Bayer b1b8e7defd - alex gaynor's latest batch of pypy test fixes 2011-03-16 13:04:07 -04:00
Taavi Burns 1b812102a7 Removing unused symbol import 2011-03-15 16:01:58 -04:00
Mike Bayer a7f766d7c7 - establish an "insert" option for events to control ordering if needed (not needed yet tho)
- render foreign key constraints in the order in which they were cerated
2011-02-25 13:20:43 -05:00
Mike Bayer 7e8f351097 - Non-DBAPI errors which occur in the scope of an execute()
call are now wrapped in sqlalchemy.exc.StatementError,
and the text of the SQL statement and repr() of params
is included.  This makes it easier to identify statement
executions which fail before the DBAPI becomes
involved.  [ticket:2015]
2011-02-09 18:11:40 -05:00
Mike Bayer eee9b55f0c rename 'frozendict' to 'immutabledict', since 'frozen' implies hashability
like frozenset which isn't really the purpose of 'immutabledict' (could be someday,
in which case, we'd change the name back :) )
2011-01-20 13:32:59 -05:00
Mike Bayer 350aed3fdb - whitespace removal bonanza 2011-01-02 14:23:42 -05:00
Mike Bayer 426c4356eb - removes the "on_" prefix. 2010-12-30 14:22:43 -05:00
Mike Bayer ecf1571ba7 - factor out the dependency on the "on_" name 2010-12-30 14:07:15 -05:00
Mike Bayer 7f7bccfc83 - they don't want "on_". First step, change the naming convention on Events
so that non-events are just _name.
2010-12-30 13:43:39 -05:00
Mike Bayer f1e54a69fb - merge default tip 2010-12-05 14:56:26 -05:00
Mike Bayer 1f9029597c - move topological, queue into util
- move function_named into test.lib.util
- use @decorator for all decorators in test/
2010-12-05 12:51:24 -05:00
Mike Bayer d30678d18d new calling style: event.listen(target, identifier, fn) 2010-12-01 14:10:11 -05:00
Mike Bayer 58b2939433 - sqlalchemy.test and nose plugin moves back to being entirely
outside of "sqlalchemy" and under "test/".

Rationale:

- coverage plugin works without issue, without need for an awkward
additional package install
- command line for "nosetests" isn't polluted with SQLAlchemy options

[ticket:1949]
2010-11-28 14:19:44 -05:00