summaryrefslogtreecommitdiff
path: root/test/base
Commit message (Collapse)AuthorAgeFilesLines
* Ensure Oracle index w/ col DESC etc. is reflectedMike Bayer2017-08-141-1/+36
| | | | | | | | | | | | | | | | | | | | Fixed bug where an index reflected under Oracle with an expression like "column DESC" would not be returned, if the table also had no primary key, as a result of logic that attempts to filter out the index implicitly added by Oracle onto the primary key columns. Reworked the "filter out the primary key index" logic in oracle get_indexes() to be clearer. This changeset also adds an internal check to ColumnCollection to accomodate for the case of a column being added twice, as well as adding a private _table argument to Index such that reflection can specify the Table explicitly. The _table argument can become part of public API in a later revision or release if needed. Change-Id: I745711e03b3e450b7f31185fc70e10d3823063fa Fixes: #4042
* Make all tests to be PEP8 compliantKhairi Hafsham2017-02-075-107/+140
| | | | | | | | tested using pycodestyle version 2.2.0 Fixes: #3885 Change-Id: I5df43adc3aefe318f9eeab72a078247a548ec566 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/343
* Check for __module__ not present in util.wrap_callable()Mike Bayer2016-10-141-0/+13
| | | | | | | | | The newly added wrap_callable() function assumes __module__ is present when this is not the case for objects such as functools.partial. Change-Id: Ia226260e9a65419e26d5c1f7187512f7fd4bb7c1 Fixes: #3823
* Repair pickling for Properties objectPieter Mulder2016-06-291-0/+35
| | | | | | | | | | | | | Fixed bug whereby the ``__getstate__`` / ``__setstate__`` methods for sqlalchemy.util.Properties were non-working due to the transition in the 1.0 series to ``__slots__``. The issue potentially impacted some third-party applications. Pull request courtesy Pieter Mulder. Fixes: #3728 Change-Id: I01ebd425bbfe145747fea2edd0d2d412c74fd84d Pull-request: https://github.com/zzzeek/sqlalchemy/pull/286 (cherry picked from commit cab57e9bab04fbdea44690c08dff379a29eaab32)
* - Fixed bug in "to_list" conversion where a single bytes objectMike Bayer2016-02-211-1/+15
| | | | | | | would be turned into a list of individual characters. This would impact among other things using the :meth:`.Query.get` method on a primary key that's a bytes object. fixes #3660
* - revert the change first made in a6fe4dc, as we are now generalizingMike Bayer2016-01-281-1/+33
| | | | | | | | | | | | | | | | | | | | | | | the warning here to all safe_reraise() cases in Python 2. - Revisiting :ticket:`2696`, first released in 1.0.10, which attempts to work around Python 2's lack of exception context reporting by emitting a warning for an exception that was interrupted by a second exception when attempting to roll back the already-failed transaction; this issue continues to occur for MySQL backends in conjunction with a savepoint that gets unexpectedly lost, which then causes a "no such savepoint" error when the rollback is attempted, obscuring what the original condition was. The approach has been generalized to the Core "safe reraise" function which takes place across the ORM and Core in any place that a transaction is being rolled back in response to an error which occurred trying to commit, including the context managers provided by :class:`.Session` and :class:`.Connection`, and taking place for operations such as a failure on "RELEASE SAVEPOINT". Previously, the fix was only in place for a specific path within the ORM flush/commit process; it now takes place for all transational context managers as well. fixes #2696
* - Fixed bug where some exception re-raise scenarios would attachMike Bayer2016-01-181-0/+59
| | | | | | | | the exception to itself as the "cause"; while the Python 3 interpreter is OK with this, it could cause endless loops in iPython. fixes #3625 - add tests for reraise, raise_from_cause - raise_from_cause is the same on py2k/3k, use just one function
* - A deep improvement to the recently added :meth:`.TextClause.columns`Mike Bayer2016-01-141-2/+3
| | | | | | | | | | | | | | | | | | | method, and its interaction with result-row processing, now allows the columns passed to the method to be positionally matched with the result columns in the statement, rather than matching on name alone. The advantage to this includes that when linking a textual SQL statement to an ORM or Core table model, no system of labeling or de-duping of common column names needs to occur, which also means there's no need to worry about how label names match to ORM columns and so-forth. In addition, the :class:`.ResultProxy` has been further enhanced to map column and string keys to a row with greater precision in some cases. fixes #3501 - reorganize the initialization of ResultMetaData for readability and complexity; use the name "cursor_description", define the task of "merging" cursor_description with compiled column information as its own function, and also define "name extraction" as a separate task. - fully change the name we use in the "ambiguous column" error to be the actual name that was ambiguous, modify the C ext also
* - The ORM and Core tutorials, which have always been in doctest format,Mike Bayer2015-12-101-0/+144
| | | | | | | | | | | are now exercised within the normal unit test suite in both Python 2 and Python 3. - remove the old testdocs.py runner and replace with test/base/test_tutorials.py - use pytest's unicode fixer so that we can test for unicode strings in both py2k/3k - use py3k format overall for prints, exceptions - add other fixers to guarantee deterministic results - add skips and ellipses to outputs that aren't worth matching
* Fix _assert_unorderable_types on py36.pr/218Iuri de Silvio2015-11-301-1/+4
| | | | | | The error message changed to: `'<' not supported between instances of 'foo' and 'bar'`
* - convert wrap_callable() to a general purpose update_wrapper-likeMike Bayer2015-10-291-0/+69
| | | | | | function; the caller still passes in the "wrapper" - move tests for wrap_callable() to be generic util tests - changelog for pullreq github:204
* - Fixed an issue where a particular base class within utilsMike Bayer2015-07-201-1/+29
| | | | | | | | | didn't implement ``__slots__``, and therefore meant all subclasses of that class didn't either, negating the rationale for ``__slots__`` to be in use. Didn't cause any issue except on IronPython which apparently does not implement ``__slots__`` behavior compatibly with cPython. Fixes #3494
* - Fixed an internal "memoization" routine for method types suchMike Bayer2015-06-081-1/+2
| | | | | that a Python descriptor is no longer used; repairs inspectability of these methods including support for Sphinx documentation.
* - Added support for the case of the misbehaving DBAPI that hasMike Bayer2015-05-151-0/+57
| | | | | | | | | | | pep-249 exception names linked to exception classes of an entirely different name, preventing SQLAlchemy's own exception wrapping from wrapping the error appropriately. The SQLAlchemy dialect in use needs to implement a new accessor :attr:`.DefaultDialect.dbapi_exception_translation_map` to support this feature; this is implemented now for the py-postgresql dialect. fixes #3421
* unit-test deterministic topological sortSebastian Bank2015-03-071-0/+29
|
* - 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__
* - The :meth:`.PropComparator.of_type` modifier has beenMike Bayer2014-11-241-0/+30
| | | | | | | | | | | | | | | improved in conjunction with loader directives such as :func:`.joinedload` and :func:`.contains_eager` such that if two :meth:`.PropComparator.of_type` modifiers of the same base type/path are encountered, they will be joined together into a single "polymorphic" entity, rather than replacing the entity of type A with the one of type B. E.g. a joinedload of ``A.b.of_type(BSub1)->BSub1.c`` combined with joinedload of ``A.b.of_type(BSub2)->BSub2.c`` will create a single joinedload of ``A.b.of_type((BSub1, BSub2)) -> BSub1.c, BSub2.c``, without the need for the ``with_polymorphic`` to be explicit in the query. fixes #3256
* - Exception messages have been spiffed up a bit. The SQL statementMike Bayer2014-10-171-13/+21
| | | | | | | | | | | and parameters are not displayed if None, reducing confusion for error messages that weren't related to a statement. The full module and classname for the DBAPI-level exception is displayed, making it clear that this is a wrapped DBAPI exception. The statement and parameters themselves are bounded within a bracketed sections to better isolate them from the error message and from each other. fixes #3172
* pep8Mike Bayer2014-10-171-38/+54
|
* - The ``__module__`` attribute is now set for all those SQL andMike Bayer2014-10-141-1/+38
| | | | | | | ORM functions that are derived as "public factory" symbols, which should assist with documentation tools being able to report on the target module. fixes #3218
* - the test_except test was doing an unnecessary workaround of some kind,Mike Bayer2014-10-121-8/+1
| | | | take that out, restore the better exception logic in exc
* - 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
* - A new implementation for :class:`.KeyedTuple` used by theMike Bayer2014-08-281-25/+39
| | | | | | :class:`.Query` object offers dramatic speed improvements when fetching large numbers of column-oriented rows. fixes #3176
* - 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
|
* - fix unit test affected by #3075Mike Bayer2014-07-291-5/+8
|
* - 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.
* put fails for these various things that don't work on pypy, not sure what ↵Mike Bayer2014-03-081-1/+7
| | | | | | approach should be taken
* fix pypy failuresMike Bayer2014-03-031-2/+1
|
* - get util.get_callable_argspec() to be completely bulletproof for 2.6-3.4,Mike Bayer2014-03-021-1/+86
| | | | | methods, classes, builtins, functools.partial(), everything known so far - use get_callable_argspec() within ColumnDefault._maybe_wrap_callable, re: #2979
* restore the contracts of update/extend to the degree that the same column ↵Mike Bayer2014-02-271-0/+30
| | | | | | identity isn't appended to the list. reflection makes use of this.
* - Some changes to how the :attr:`.FromClause.c` collection behavesMike Bayer2014-02-261-1/+156
| | | | | | | | | | | | | | | | | | | | | | | when presented with duplicate columns. The behavior of emitting a warning and replacing the old column with the same name still remains to some degree; the replacement in particular is to maintain backwards compatibility. However, the replaced column still remains associated with the ``c`` collection now in a collection ``._all_columns``, which is used by constructs such as aliases and unions, to deal with the set of columns in ``c`` more towards what is actually in the list of columns rather than the unique set of key names. This helps with situations where SELECT statements with same-named columns are used in unions and such, so that the union can match the columns up positionally and also there's some chance of :meth:`.FromClause.corresponding_column` still being usable here (it can now return a column that is only in selectable.c._all_columns and not otherwise named). The new collection is underscored as we still need to decide where this list might end up. Theoretically it would become the result of iter(selectable.c), however this would mean that the length of the iteration would no longer match the length of keys(), and that behavior needs to be checked out. fixes #2974 - add a bunch more tests for ColumnCollection
* - 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-042-1/+50
| | | | | | | | | | | 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]
* - Improvements to the system by which SQL types generate withinMike Bayer2013-12-181-0/+49
| | | | | | | | ``__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]
* - 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]
* - add WeakSequence.append()Mike Bayer2013-08-181-3/+33
| | | | - fix and test weakref cleanout for WeakSequence, [ticket:2794]
* - 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.
* remove all remaining start/end py2k/py3k blocksMike Bayer2013-06-072-56/+40
|
* merge defaultMike Bayer2013-05-231-2/+22
|\
| * Fixed a bug where the routine to detect the correct kwargsMike Bayer2013-05-231-2/+22
| | | | | | | | | | | | being sent to :func:`.create_engine` would fail in some cases, such as with the Sybase dialect. [ticket:2732]
* | baseMike Bayer2013-05-041-8/+6
| |
* | - the raw 2to3 runMike Bayer2013-04-274-99/+101
|/ | | | - 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]
* initializing _labels to an empty list so that the other methods don't throw ↵Diana Clarke2012-11-171-21/+12
| | | | exceptions in the None labels case, but rather return (), [], or {}. this is not backwards compatible, but doubt anyone is relying on those exceptions #2601
* adding _fields, _asdict() to KeyedTuple #2601Diana Clarke2012-11-171-4/+33
|