summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/warnings.py
Commit message (Collapse)AuthorAgeFilesLines
* happy new year 2023Mike Bayer2023-01-031-1/+1
| | | | Change-Id: I625af65b3fb1815b1af17dc2ef47dd697fdc3fb1
* Fix warnings raised by the testing moduleFederico Caselli2022-05-181-2/+6
| | | | | | | Adjust the automatic stacklevel counter to ignore sqlalchemy.testing Properly apply warning filters Change-Id: Ib3d2eb6269af5fc72881df4d39194b3b0cbb1353
* inline mypy config; files ignoring type errors for the momentMike Bayer2022-04-281-0/+2
| | | | | | | | | | | | | | | | | | | to simplify pyproject.toml change the remaining files that aren't going to be typed on this first pass (unless of course someone wants to type some of these) to include # mypy: ignore-errors. for the moment, only a handful of ORM modules are to have more type checking implemented. It's important that ignore-errors is used and not "# type: ignore", as in the latter case, mypy doesn't even read the existing types in the file, which makes it impossible to type any files that refer to those modules at all. to simplify ongoing typing work use inline mypy config for remaining files that are "done" for now, indicating the level of type checking they currently have. Change-Id: I98669c1a305c2f0adba85d10b5425541f3fe9533
* Revert SQLAlchemy warnings to warnings.pyFederico Caselli2022-02-211-5/+10
| | | | | | | | | | | | Configuring the warning filters in pyproject breaks tests if no sqlalchemy is installed in the env, since the filters are processed before loading conftest. It also may interfere with coverage. Revises Ia9715533b01f72aa5fdcf6a27ce75b76f829fa43 aba3ab247da4628e4e7baf993702e2efaccbc547 Change-Id: I51448a6a014f31d3088dce54cd20d1e683500f8c
* pep-484 for sqlalchemy.event; use future annotationsMike Bayer2022-02-151-0/+2
| | | | | | | | | | __future__.annotations mode allows us to use non-string annotations for argument and return types in most cases, but more importantly it removes a large amount of runtime overhead that would be spent in evaluating the annotations. Change-Id: I2f5b6126fe0019713fc50001be3627b664019ede References: #6810
* after all that, use pytest warnings pluginMike Bayer2022-01-231-35/+7
| | | | | | | | | | | | | | | | | The warnings plugin lets us set the filters up in the config, and as our filter requirements are now simple we can just set this up. additionally pytest now recommends pyproject.toml, since we fully include this now, let's move it there. the pytest logging plugin seems to not be any problem either at the moment, so re-enable that. if it becomes apparent whatever the problem was (which was probably that it was just surprising, or something) we can disable it again and comment what the reason was. Change-Id: Ia9715533b01f72aa5fdcf6a27ce75b76f829fa43
* dont use exception catches for warnings; modernize xdist detectionMike Bayer2022-01-221-17/+15
| | | | | | | | | | | | | | | | | Improvements to the test suite's integration with pytest such that the "warnings" plugin, if manually enabled, will not interfere with the test suite, such that third parties can enable the warnings plugin or make use of the ``-W`` parameter and SQLAlchemy's test suite will continue to pass. Additionally, modernized the detection of the "pytest-xdist" plugin so that plugins can be globally disabled using PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 without breaking the test suite if xdist were still installed. Warning filters that promote deprecation warnings to errors are now localized to SQLAlchemy-specific warnings, or within SQLAlchemy-specific sources for general Python deprecation warnings, so that non-SQLAlchemy deprecation warnings emitted from pytest plugins should also not impact the test suite. Fixes: #7599 Change-Id: Ibcf09af25228d39ee5a943fda82d8a9302433726
* happy new year 2022Mike Bayer2022-01-061-1/+1
| | | | Change-Id: I49abf2607e0eb0623650efdf0091b1fb3db737ea
* Remove all remaining removed_in_20 warnings slated for removalMike Bayer2022-01-051-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Finalize all remaining removed-in-2.0 changes so that we can begin doing pep-484 typing without old things getting in the way (we will also have to do public_factory). note there are a few "moved_in_20()" and "became_legacy_in_20()" warnings still in place. The SQLALCHEMY_WARN_20 variable is now removed. Also removed here are the legacy "in place mutators" for Select statements, and some keyword-only argument signatures in Core have been added. Also in the big change department, the ORM mapper() function is removed entirely; the Mapper class is otherwise unchanged, just the public-facing API function. Mappers are now always given a registry in which to participate, however the argument signature of Mapper is not changed. ideally "registry" would be the first positional argument. Fixes: #7257 Change-Id: Ic70c57b9f1cf7eb996338af5183b11bdeb3e1623
* Clean up most py3k compatFederico Caselli2021-11-241-3/+0
| | | | Change-Id: I8172fdcc3103ff92aa049827728484c8779af6b7
* Remove deprecated dialects and driversFederico Caselli2021-10-311-5/+0
| | | | | Fixes: #7258 Change-Id: I3577f665eca04f2632b69bcb090f0a4ec9271db9
* warnings removal, merge_resultMike Bayer2021-10-291-16/+0
| | | | | | | | | | | this is the last warning to remove. Also fixes some mistakes I made with the new Base20DeprecationWarning and LegacyAPIWarning classes created, where functions in deprecations.py were still hardcoded to RemovedIn20Warning. Change-Id: I9a6045ac9b813fd2f9668c4bc518c46a7774c6ef
* Merge "warnings: session.autocommit, subtransactions" into mainmike bayer2021-10-291-2/+0
|\
| * warnings: session.autocommit, subtransactionsMike Bayer2021-10-291-2/+0
| | | | | | | | Change-Id: I7eb7c87c9656f8043ea90d53897958afad2b8fe9
* | warnings: with_polymorphic()Mike Bayer2021-10-291-5/+0
|/ | | | | | | | Also clarifies a behavior of None/False for the selectable parameter to with_polymorphic() Fixes: #7262 Change-Id: I58c4004e0af227d3995e9ae2461470440f97f252
* Merge "Modernize tests - session_query_get" into mainmike bayer2021-10-291-1/+0
|\
| * Modernize tests - session_query_getGord Thompson2021-10-281-1/+0
| | | | | | | | | | Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com> Change-Id: I92013aad471baf32df1b51b756e86d95449b5cfd
* | warnings: cascade_backrefsMike Bayer2021-10-281-2/+0
|/ | | | | | | this one is a little different in that the thing changing is the detection of a behavior, not an explicit API. Change-Id: Id142943a2b901b39fe9053d0120c1e820dc1a6d0
* Merge "deprecation warnings: with_parent, aliased, from_joinpoint" into mainmike bayer2021-10-271-3/+0
|\
| * deprecation warnings: with_parent, aliased, from_joinpointMike Bayer2021-10-271-3/+0
| | | | | | | | | | | | | | | | | | most of the work for aliased / from_joinpoint has been done already as I added all new tests for these and moved most aliased/from_joinpoint to test/orm/test_deprecations.py already Change-Id: Ia23e332dec183de17b2fb9d89d946af8d5e89ae7
* | Merge "Remove depractions:" into mainmike bayer2021-10-261-2/+0
|\ \ | |/ |/|
| * Remove depractions:Federico Caselli2021-10-261-2/+0
| | | | | | | | | | | | | | - Passing bind arguments to Session.execute - This Session located a target engine via bound metadata Change-Id: I916c8c4cff344ee5652fceac4dfd241dd8160f7b
* | warnings: select_entity_from()Mike Bayer2021-10-251-1/+0
| | | | | | | | Change-Id: I8c259e61134c38a1fa907c308068337473c82914
* | deprecation warnings: strings in loader options, join, with_parentMike Bayer2021-10-251-8/+0
|/ | | | | | | | | | | | | Repairs one in-library deprecation warning regarding mapper propagation of options raises maxfail to 250, as 25 is too low when we are trying to address many errors at once. the 25 was originally due to the fact that our fixtures would be broken after that many failures in most cases, which today should not be the case nearly as often. Change-Id: I26affddf42e2cae2aaf9561633e9b8cd431eb189
* Modernize tests - query_from_selfGord Thompson2021-10-171-1/+0
| | | | Change-Id: Ic14fdb5b6c49b668698de146bbafbd996da3d843
* Modernize tests - calling_mapper_directlyGord Thompson2021-09-301-5/+0
| | | | | | | | | | | | | a few changes for py2k: * map_imperatively() includes the check that a class is being sent, this was only working for mapper() before * the test suite didn't place the py2k "autouse" workaround in the correct order, seemingly, tried to adjust the per-test ordering setup in pytestplugin.py Change-Id: I4cc39630724e810953cfda7b2afdadc8b948e3c2
* remove declarative warningsMike Bayer2021-09-291-4/+0
| | | | | | | * sqlalchemy.ext.declarative names * declarative_base(bind) Change-Id: I0ca26894b224458b58e46504c5ff7b5d3031a829
* Modernize tests - remaining DMLGord Thompson2021-08-121-7/+0
| | | | | | | dialect_keyword_arguments preserve_parameter_order Change-Id: I92efce4689635ef4b68fc02100c0c10aff9a0edc
* Merge "Modernize tests - dml_values"mike bayer2021-08-071-2/+0
|\
| * Modernize tests - dml_valuesGord Thompson2021-07-261-2/+0
| | | | | | | | Change-Id: Ida86ed40c43d91813151621b847376976773a5f9
* | Merge "Modernize tests - remaining core SQL"mike bayer2021-08-071-8/+0
|\ \ | |/ |/|
| * Modernize tests - remaining core SQLGord Thompson2021-07-231-8/+0
| | | | | | | | Change-Id: I7d8c1f451c32dea28173b2206e66db1d0927fccf
* | Modernize tests - dml_whereclauseGord Thompson2021-07-261-2/+0
|/ | | | | | | | | Fixed issue where the unit of work would internally use a 2.0-deprecated SQL expression form, emitting a deprecation warning when SQLALCHEMY_WARN_20 were enabled. Fixes: #6812 Change-Id: I0a031e728527a1c3382848b6ddc793939362b128
* Merge "Modernize tests - legacy_select"mike bayer2021-07-211-2/+0
|\
| * Modernize tests - legacy_selectGord Thompson2021-07-211-2/+0
| | | | | | | | Change-Id: I04057cc3d3f93de60b02999803e2ba6a23cdf68d
* | dont warn for dictionary passed positionallyMike Bayer2021-07-211-1/+0
|/ | | | | | | | | | | | | Fixed issue where use of the :paramref:`_sql.case.whens` parameter passing a dictionary positionally and not as a keyword argument would emit a 2.0 deprecation warning, referring to the deprecation of passing a list positionally. The dictionary format of "whens", passed positionally, is still supported and was accidentally marked as deprecated. Removes warning filter for case statement. Fixes: #6786 Change-Id: I8efd1882563773bec89ae5e34f0dfede77fc4683
* Modernize tests - unionGord Thompson2021-07-121-1/+0
| | | | Change-Id: I2ccb714a249350f23e2b5f78f5f9ffb0d4f7efb0
* Merge "Modernize tests - select(whereclause)"mike bayer2021-07-121-7/+0
|\
| * Modernize tests - select(whereclause)Gord Thompson2021-07-041-7/+0
| | | | | | | | Change-Id: I306cfbea9920b35100e3087dcc21d7ffa6c39c55
* | Replace all http:// links to https://Federico Caselli2021-07-041-1/+1
|/ | | | | | Also replace http://pypi.python.org/pypi with https://pypi.org/project Change-Id: I84b5005c39969a82140706472989f2a30b0c7685
* Modernize testsGord Thompson2021-07-031-1/+0
| | | | | | Eliminate engine.execute() and engine.scalar() Change-Id: I99f76d0e615ddebab2da4fd07a40a0a2796995c7
* Modernize tests - Connection.connectGord Thompson2021-06-261-1/+0
| | | | Change-Id: I61639dc2d7e7bcae6c53e2a15680b11fce3efa5d
* turn pg provision error into a warningMike Bayer2021-06-261-0/+10
| | | | | | | | | | | | | We haven't had any real cases of the PG "cant drop tables" condition since this error was first introduced; instead we seem to get it for a non-critical query during pool reconnect tests, and I have not been able to isolate what is causing it. Therefore turn the error into a new class of warning that can emit within the test suite without failing the test, so that if we do get a real PG drop timeout, the warning will be there to show us what the query was in which it was stuck. Change-Id: I1a9b3c4f7a25b7b9c1af722a721fc44ad5575b0f
* Remove pytest warning filterFederico Caselli2021-05-281-6/+0
| | | | Change-Id: Ie18b66e4a8d59be12ee549347bd508036282c1c9
* get tests to pass on python 3.10Mike Bayer2021-05-271-2/+11
| | | | | | | | | | | | | | Resolved various deprecation warnings which were appearing as of Python version 3.10.0b1. block aiomysql on python 3.10 as they are using the "loop" argument that's removed sqlcipher-binary has no builds on 3.10, block it for 3.10 Fixes: #6540 Fixes: #6543 Change-Id: Iec1e3881fb289878881ae043b1a18c3ecdf5f077
* Fix LegacyRow/Row index accessMike Bayer2021-04-081-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed up the behavior of the :class:`_result.Row` object when dictionary access is used upon it, meaning converting to a dict via ``dict(row)`` or accessing members using strings or other objects i.e. ``row["some_key"]`` works as it would with a dictionary, rather than raising ``TypeError`` as would be the case with a tuple, whether or not the C extensions are in place. This was originally supposed to emit a 2.0 deprecation warning for the "non-future" case using :class:`_result.LegacyRow`, and was to raise ``TypeError`` for the "future" :class:`_result.Row` class. However, the C version of :class:`_result.Row` was failing to raise this ``TypeError``, and to complicate matters, the :meth:`_orm.Session.execute` method now returns :class:`_result.Row` in all cases to maintain consistency with the ORM result case, so users who didn't have C extensions installed would see different behavior in this one case for existing pre-1.4 style code. Therefore, in order to soften the overall upgrade scheme as most users have not been exposed to the more strict behavior of :class:`_result.Row` up through 1.4.6, :class:`_result.LegacyRow` and :class:`_result.Row` both provide for string-key access as well as support for ``dict(row)``, in all cases emitting the 2.0 deprecation warning when ``SQLALCHEMY_WARN_20`` is enabled. The :class:`_result.Row` object still uses tuple-like behavior for ``__contains__``, which is probably the only noticeable behavioral change compared to :class:`_result.LegacyRow`, other than the removal of dictionary-style methods ``values()`` and ``items()``. Also remove filters for result set warnings. callcounts updated for 2.7/ 3.9, am pushing jenkins to use python 3.9 now Fixes: #6218 Change-Id: Ia69b974f3dbc46943c57423f57ec82323c8ae63b
* update execute() arg formats in modules and testsMike Bayer2021-01-151-3/+0
| | | | | | | | | | | | | continuing with producing a SQLAlchemy 1.4.0b2 that internally does not emit any of its own 2.0 deprecation warnings, migrate the *args and **kwargs passed to execute() methods that now must be a single list or dictionary. Alembic 1.5 is again waiting on this internal consistency to be present so that it can pass all tests with no 2.0 deprecation warnings. Change-Id: If6b792e57c8c5dff205419644ab68e631575a2fa
* remove more bound metadataMike Bayer2021-01-051-5/+0
| | | | | | | | | | | | | | in Iae6ab95938a7e92b6d42086aec534af27b5577d3 I missed that the "bind" was being stuck onto the MetaData in TablesTest, which led thousands of ORM tests to still use bound metadata. Keep looking for bound metadata. standardize all ORM tests on a single means of getting a Session when the Session API isn't the thing we are directly testing, using a new function fixture_session() that replaces create_session() and uses modern defaults. Change-Id: Iaf71206e9ee568151496d8bc213a069504bf65ef
* happy new yearMike Bayer2021-01-041-1/+1
| | | | Change-Id: Ic5bb19ca8be3cb47c95a0d3315d84cb484bac47c
* remove metadata.bind use from test suiteMike Bayer2021-01-031-1/+0
| | | | | | | | | | | | | | importantly this means we can remove bound metadata from the fixtures that are used by Alembic's test suite. hopefully this is the last one that has to happen to allow Alembic to be fully 1.4/2.0. Start moving from @testing.provide_metadata to a pytest metadata fixture. This does not seem to have any negative effects even though TablesTest uses a "self.metadata" attribute. Change-Id: Iae6ab95938a7e92b6d42086aec534af27b5577d3