summaryrefslogtreecommitdiff
path: root/test/base/test_events.py
Commit message (Collapse)AuthorAgeFilesLines
* Make all tests to be PEP8 compliantKhairi Hafsham2017-02-071-1/+1
| | | | | | | | tested using pycodestyle version 2.2.0 Fixes: #3885 Change-Id: I5df43adc3aefe318f9eeab72a078247a548ec566 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/343
* - scale back _Dispatch and _JoinedDispatcher to use a __getitem__ schemeMike Bayer2015-01-041-6/+12
| | | | | | to start up listener collections; this pulls the overhead off of construction and makes performance much like the descriptor version, while still allowing slots. Fix up some profiles.
* - wip - start factoring events so that we aren't using descriptors for dispatch,Mike Bayer2015-01-041-15/+6
| | | | allowing us to move to __slots__
* - Fixed bug that affected generally the same classes of eventMike Bayer2014-09-181-13/+97
| | | | | | | | | | as that of :ticket:`3199`, when the ``named=True`` parameter would be used. Some events would fail to register, and others would not invoke the event arguments correctly, generally in the case of when an event was "wrapped" for adaption in some other way. The "named" mechanics have been rearranged to not interfere with the argument signature expected by internal wrapper functions. fixes #3197
* - Fixed bug that affected many classes of event, particularlyMike Bayer2014-09-181-0/+59
| | | | | | | | | | | ORM events but also engine events, where the usual logic of "de duplicating" a redundant call to :func:`.event.listen` with the same arguments would fail, for those events where the listener function is wrapped. An assertion would be hit within registry.py. This assertion has now been integrated into the deduplication check, with the added bonus of a simpler means of checking deduplication across the board. fixes #3199
* - Removing (or adding) an event listener at the same time that the eventMike Bayer2014-08-141-0/+34
| | | | | | | | | is being run itself, either from inside the listener or from a concurrent thread, now raises a RuntimeError, as the collection used is now an instance of ``colletions.deque()`` and does not support changes while being iterated. Previously, a plain Python list was used where removal from inside the event itself would produce silent failures. fixes #3163
* pep8Mike Bayer2014-08-141-31/+46
|
* - Added a new keyword argument ``once=True`` to :func:`.event.listen`Mike Bayer2014-03-111-0/+25
| | | | | and :func:`.event.listens_for`. This is a convenience feature which will wrap the given listener such that it is only invoked once.
* - Fixed bug where events set to listen at the classMike Bayer2014-02-251-5/+33
| | | | | | | | level (e.g. on the :class:`.Mapper` or :class:`.ClassManager` level, as opposed to on an individual mapped class, and also on :class:`.Connection`) that also made use of internal argument conversion (which is most within those categories) would fail to be removable. fixes #2973
* - Fixed regression where using a ``functools.partial()`` with the eventMike Bayer2014-01-041-0/+20
| | | | | | | | | | | 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]
* - add support for removal of instance methods as event listeners, takingMike Bayer2013-10-011-0/+26
| | | | into account the id() of the function itself and self, [ticket:2832]
* - Removal of event listeners is now implemented. The feature isMike Bayer2013-07-261-24/+178
| | | | | | | | | | | | | | | | 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.
* - create a new system where we can decorate an event methodMike Bayer2013-07-081-0/+215
| | | | | | | | | | | | | | | | 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]
* - replace most explicitly-named test objects called "Mock..." withMike Bayer2013-06-301-69/+67
| | | | | | | | | | | | 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.
* - the raw 2to3 runMike Bayer2013-04-271-2/+2
| | | | - went through examples/ and cleaned out excess list() calls
* - add workaround for sqlite memusage tests, so no longer need to count to ↵Mike Bayer2013-01-121-1/+27
| | | | | | | | | | | | | 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]
* trying different approaches to test layout. in this one, the testing modulesMike Bayer2012-09-271-2/+2
| | | | | | | 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.
* - repair bool() for instance level event listener where events are ↵Mike Bayer2012-09-201-0/+7
| | | | classlevel, continuing [ticket:2516]
* - [feature] The before_cursor_execute eventMike Bayer2012-08-231-6/+220
| | | | | | | | | 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]
* -whitespace bonanza, contdMike Bayer2012-07-281-1/+1
|
* - [feature] Dramatic improvement in memoryMike Bayer2012-06-201-29/+50
| | | | | | | | 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.
* - [bug] Fixed event registration bugMike Bayer2012-03-071-0/+104
| | | | | | | | 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]
* - Added @event.listens_for() decorator, givenMike Bayer2011-04-021-44/+68
| | | | | | target + event name, applies the decorated function as a listener. [ticket:2106] - remove usage of globals from test.base.test_events
* - move all the comments that got shoved below the fixture grabs back upMike Bayer2011-03-271-0/+1
|
* - remove test.sql._base, test.engine._base, test.orm._base, move those ↵Mike Bayer2011-03-271-6/+7
| | | | | | | classes to a new test.lib.fixtures module - move testing.TestBase to test.lib.fixtures - massive search and replace
* - establish an "insert" option for events to control ordering if needed (not ↵Mike Bayer2011-02-251-0/+19
| | | | | | needed yet tho) - render foreign key constraints in the order in which they were cerated
* - whitespace removal bonanzaMike Bayer2011-01-021-50/+50
|
* - removes the "on_" prefix.Mike Bayer2010-12-301-46/+46
|
* - factor out the dependency on the "on_" nameMike Bayer2010-12-301-1/+1
|
* - they don't want "on_". First step, change the naming convention on EventsMike Bayer2010-12-301-3/+3
| | | | so that non-events are just _name.
* new calling style: event.listen(target, identifier, fn)Mike Bayer2010-12-011-16/+16
|
* - sqlalchemy.test and nose plugin moves back to being entirelyMike Bayer2010-11-281-1/+1
| | | | | | | | | | | | 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]
* - propagate flag on event.listen() results in the listener being placedMike Bayer2010-11-071-14/+0
| | | | | | | | | | | in a separate collection. this collection also propagates during update() - ClassManager now handles bases, subclasses collections. - ClassManager looks at __bases__ instead of __mro__ for superclasses. It's assumed ClassManagers are in an unbroken chain upwards through __mro__. - trying to get a clear() that makes sense on cls.dispatch - implemented propagate for attribute events, plus permutation-based test - implemented propagate for mapper / instance events with rudimentary test - some pool events tests are failing for some reason
* - attempting system of propagation. getting stuck on attempting to use ↵Mike Bayer2010-11-061-0/+47
| | | | instance methods as listeners.
* - begin adding tests for event registration and dispatch standaloneMike Bayer2010-10-021-0/+231
- fix pickling again - other test fixes