summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/plugin
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix a wide variety of typos and broken linksaplatkouski2020-06-251-1/+1
| | | | | | | | | | | | Note the PR has a few remaining doc linking issues listed in the comment that must be addressed separately. Signed-off-by: aplatkouski <5857672+aplatkouski@users.noreply.github.com> Closes: #5371 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5371 Pull-request-sha: 7e7d233cf3a0c66980c27db0fcdb3c7d93bc2510 Change-Id: I9c36e8d8804483950db4b42c38ee456e384c59e3
* Add support for "real" sequences in mssqlGord Thompson2020-05-291-0/+2
| | | | | | | | | | | | | | | | | Added support for "CREATE SEQUENCE" and full :class:`.Sequence` support for Microsoft SQL Server. This removes the deprecated feature of using :class:`.Sequence` objects to manipulate IDENTITY characteristics which should now be performed using ``mssql_identity_start`` and ``mssql_identity_increment`` as documented at :ref:`mssql_identity`. The change includes a new parameter :paramref:`.Sequence.data_type` to accommodate SQL Server's choice of datatype, which for that backend includes INTEGER and BIGINT. The default starting value for SQL Server's version of :class:`.Sequence` has been set at 1; this default is now emitted within the CREATE SEQUENCE DDL for all backends. Fixes: #4235 Fixes: #4633 Change-Id: I6aa55c441e8146c2f002e2e201a7f645e667b916
* Add full profile sort, dumping to profile resultsMike Bayer2020-05-281-0/+7
| | | | Change-Id: Ib256ae34de15d29ee9a48e3be86073610f8d1a65
* Update transaction / connection handlingMike Bayer2020-05-171-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | step one, do away with __connection attribute and using awkward AttributeError logic step two, move all management of "connection._transaction" into the transaction objects themselves where it's easier to follow. build MarkerTransaction that takes the role of "do-nothing block" new connection datamodel is: connection._transaction, always a root, connection._nested_transaction, always a nested. nested transactions still chain to each other as this is still sort of necessary but they consider the root transaction separately, and the marker transactions not at all. introduce new InvalidRequestError subclass PendingRollbackError. Apply to connection and session for all cases where a transaction needs to be rolled back before continuing. Within Connection, both PendingRollbackError as well as ResourceClosedError are now raised directly without being handled by handle_dbapi_error(); this removes these two exception cases from the handle_error event handler as well as from StatementError wrapping, as these two exceptions are not statement oriented and are instead programmatic issues, that the application is failing to handle database errors properly. Revise savepoints so that when a release fails, they set themselves as inactive so that their rollback() method does not throw another exception. Give savepoints another go on MySQL, can't get release working however get support for basic round trip going Fixes: #5327 Change-Id: Ia3cbbf56d4882fcc7980f90519412f1711fae74d
* Rename py.test to pytestGord Thompson2020-04-162-4/+4
| | | | Change-Id: I431e1ef41e26d490343204a75a5c097768749768
* Dont raise on pytest deprecation warningsMike Bayer2020-03-121-0/+13
| | | | | | | | | py.test 5.4.0 emits deprecation warnings for pytest.Class. make sure we don't raise for these, and log the code that will be used for 5.4.0 when we bump requirements. Fixes: #5201 Change-Id: I83e0402c4a6b2365a63b58d052c6989df3a37328
* Rework combination exclusionsMike Bayer2020-02-101-41/+123
| | | | | | | | | | | | | | | | | | | | | | | | | The technique arrived at for doing exclusions inside of combinations relies upon comparing all the arguments in a particular combination to some set of combinations that were gathered as having "exclusions". This logic is actually broken for the case where the @testing.combinations has an "id", but if we fix that, we still have the issue of all the arguments being compared, which is complicated and also doesn't work for the case of a py2/py3 incompatibility like a timezone that has fractional minutes or seconds in it. It's also not clear if a @testing.combinations that uses lambdas will work either (maybe it does though because lambdax == lambdax compares...). anyway, this patch reworks it so that we hit this on the decorator side instead, where we add our own decorator and go through the extra effort to create a decorator that accepts an extra argument of "exclusions" which we can then check in a way that is local to the whole pytest @combinations thing in the first place. The only difficulty is that pytest is very sneaky about looking at the test function so we need to make sure __wrapped__ isn't set when doing this. Change-Id: Ic57aae15b378e0f4ed009e4e82ae7ba73fb6dfc5
* happy new yearMike Bayer2020-01-011-1/+1
| | | | Change-Id: I08440dc25e40ea1ccea1778f6ee9e28a00808235
* Introduce lambda combinationsMike Bayer2019-12-041-2/+10
| | | | | | | | | | | | As the ORM's combinatoric tests mostly use entities and table metadata that's defined in fixtures, we can't use @testing.combinations directly as it takes place at the module level. Instead we use lambdas, but to reduce verbosity we use a code replacement so that the namespace of the lambda can be provided at runtime rather than module import time. Change-Id: Ia63a510f9c1d08b055eef62cf047f1f427f0450c
* Test fixture improvementsMike Bayer2019-11-112-0/+6
| | | | | | | | | | - ensure we escape out percent signs when a CompiledSQL or RegexSQL has percent signs in the SQL or in the parameter repr - to support combinations, print out complete test name in skip messages, py.test environment gives us a way to do this Change-Id: Ia9e62f7c1026c1465986144c5757e35fc164a2b8
* Support exclusion rules in combinationsMike Bayer2019-11-091-2/+32
| | | | | | | | | | | Like py.test we need to be able to mark certain combination elements with exclusion rules. Add additional logic to pytestlplugin and exclusions so that the exclusion decorators can be added to the combination tuples, where they will be applied to the decorated function along with a qualifier that the test arguments need to match what's given. Change-Id: I15d2839954d77a252bab5aaf6e3fd9f388c99dd5
* Refactor dialect tests for combinationsMike Bayer2019-10-222-3/+3
| | | | | | | | | | | | | | Dialect tests tend to have a lot of lists of types, SQL constructs etc, convert as many of these to @combinations as possible. This is exposing that we don't have per-combination exclusion rules set up which is making things a little bit cumbersome. Also set up a fixture that does metadata + DDL. Change-Id: Ief820e48c9202982b0b1e181b87862490cd7b0c3
* Implement facade for pytest parametrize, fixtures, classlevelMike Bayer2019-10-202-16/+185
| | | | | | | | | | | | | | | | | | | Add factilities to implement pytest.mark.parametrize and pytest.fixtures patterns, which largely resemble things we are already doing. Ensure a facade is used, so that the test suite remains independent of py.test, but also tailors the functions to the more limited scope in which we are using them. Additionally, create a class-based version that works from the same facade. Several old polymorphic tests as well as two of the sql test are refactored to use the new features. Change-Id: I6ef8af1dafff92534313016944d447f9439856cf References: #4896
* move pytest assert rewrite to conftest.pyMike Bayer2019-09-231-2/+0
| | | | | | | | | this seems to be the best place to put this as it is guaranteed before the module is imported. this is for the benefit of 3rd party dialects that also would have this in their conftest.py, so that they don't have to do the "bootstrap" loading hack. Change-Id: Ieae5324240e04a7919df46f4fca03f8db7a2af81
* Add profile sort option to test suiteMike Bayer2019-07-141-1/+9
| | | | | | | | I use the nfl sort a lot to see what calling changes are happening between two versions in order to identify the offending code, so add it as a command line option. Change-Id: Ia1ab6dd98012a78298b325bb5c7c050fa9b767c2
* profiling plugin fixesMike Bayer2019-07-111-1/+1
| | | | | | | | support that we have pytest-xdist arguments now, as well as allow force-write to reset the list of callcounts which seem to accumulate commas for some reason Change-Id: I54dd164c21ffbb9139937d5c3ffb1df7e9598594
* Register pytest assertion rewriting on sqlalchemy.testing.assertionsMike Bayer2019-06-211-0/+2
| | | | | | | | Since our various eq_(), ne_() etc. functions use assert, pytest can rewrite this module using its enhanced string reporting. very helpful for comparing SQL strings Change-Id: Ia71328401fd7965bcb14eb1ccea0dc48a8f2c3ea
* Add option for "sparse" backend tests and apply to memusageMike Bayer2019-06-201-6/+30
| | | | | | | | | | | The memusage tests are extremely time and memory intensive, and when CI runs against MySQL or Postgresql there are many database/driver combinations for which the "backend" tests repeatedly run; as these tests are more oriented towards basic dialect interaction, add a new "sparse" backend option that will run the tests only once per base dialect. Change-Id: I312aa0332d7ec1ff4e2faa15f6b189d6f0f68393
* Enable F841Mike Bayer2019-06-201-1/+0
| | | | | | | | | | | This is a very useful assertion which prevents unused variables from being set up allows code to be more readable and sometimes even more efficient. test suites seem to be where the most problems are and there do not seem to be documentation examples that are using this, or at least the linter is not taking effect within rst blocks. Change-Id: I2b3341d8dd14da34879d8425838e66a4b9f8e27d
* Use pytest items in custom collectionMike Bayer2019-04-131-5/+9
| | | | | | | | | We have a custom test collection hook that did not take node of the actual list of functions in items. By looking in this list we now support the class/function arguments passed to the py.test command line. Change-Id: I1238c7c5796a296037ab9ef3bedf0f619a730481
* Remove Nose supportParth Shandilya2019-02-023-122/+6
| | | | | | | | | | | | | | The test system has removed support for Nose, which is unmaintained for several years and is producing warnings under Python 3. The test suite is currently standardized on Pytest. Pull request courtesy Parth Shandilya. Fixes: #4460 Closes: #4476 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4476 Pull-request-sha: e857af9c7d07355e52841149ee2e5d4448409e1e Change-Id: I76516fae1cf0eb58f2e9fc9f692e591e0fcf39a4
* happy new yearMike Bayer2019-01-112-2/+2
| | | | Change-Id: I6a71f4924d046cf306961c58dffccf21e9c03911
* Post black reformattingMike Bayer2019-01-064-8/+14
| | | | | | | | | | | | | Applied on top of a pure run of black -l 79 in I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9, this set of changes resolves all remaining flake8 conditions for those codes we have enabled in setup.cfg. Included are resolutions for all remaining flake8 issues including shadowed builtins, long lines, import order, unused imports, duplicate imports, and docstring issues. Change-Id: I4f72d3ba1380dd601610ff80b8fb06a2aff8b0fe
* Run black -l 79 against all source filesMike Bayer2019-01-064-183/+310
| | | | | | | | | | | | | | This is a straight reformat run using black as is, with no edits applied at all. The black run will format code consistently, however in some cases that are prevalent in SQLAlchemy code it produces too-long lines. The too-long lines will be resolved in the following commit that will resolve all remaining flake8 issues including shadowed builtins, long lines, import order, unused imports, duplicate imports, and docstring issues. Change-Id: I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9
* commit 1b774808c926665047bf353222ecd191679a95d1Lele Gaifax2018-12-301-1/+1
| | | | | | | | | | | | | | | Author: Lele Gaifax <lele@metapensiero.it> Date: Tue Dec 25 12:35:41 2018 +0100 Consistently use "PostgreSQL", fixing also a few doc glitches commit 0e382aaee4427193926f0dc10ad29056bc12c85e Author: Lele Gaifax <lele@metapensiero.it> Date: Tue Dec 25 12:08:49 2018 +0100 Remove duplicated words Change-Id: Iaa586b9412f46a50fe6ff3bbb92e07d6cb1905c8
* Default server_version_info to (0, )Mike Bayer2018-05-111-1/+1
| | | | | | | | | Fixed a bug in the test suite where if an external dialect returned ``None`` for ``server_version_info``, the exclusion logic would raise an ``AttributeError``. Change-Id: I9124d3ac5484941081127274e6eb71f392fb94f7 Fixes: #4249
* Remove erroneous skip messageMike Bayer2018-02-161-18/+14
| | | | | | | | | The logic here seems to try to say something different when __backend__ is True but it produces a nonsensical message, since __only_on__ doesn't tell us about the implementation we are actually running. Change-Id: I14e20cadcba975f8efe8fdefa439c8b8c480b3ed
* happy new yearMike Bayer2018-01-122-2/+2
| | | | Change-Id: I3ef36bfd0cb0ba62b3123c8cf92370a43156cf8f
* Fix noseplugin to accept `zeroarg_callback` for `--dbs` optionIryna Shcherbina2017-09-261-1/+1
| | | ./sqla_nose.py --dbs works fine with zero arguments, so `zeroarg_callback` should be treated as `callback`.
* - allow a separate template database to be used forMike Bayer2017-08-221-0/+3
| | | | | | | PG CREATE DATABASE. as nobody will connect to it that would solve the contention issue here Change-Id: I00a4d52091876e120faff4a8a5493c53280d96f1
* - repair --dbsMike Bayer2017-08-222-1/+21
| | | | | Change-Id: I69e39d2368f50b126c369ecc35e01799fd013254 (cherry picked from commit 3fc6f32ddc5fbbf439acff42c2fdae9e910154be)
* - sanitize class names for junit reportingMike Bayer2017-08-211-1/+8
| | | | Change-Id: I42821d8324208b708adc17a10b1a2758797cb9db
* - rework oracle de-provisioning to write URLs to the file as well,Mike Bayer2017-08-202-4/+5
| | | | | | supporting custom dburi etc. Change-Id: Ic0ab0b3b4223e40fd335ee3313fda4dfce942100
* Isolate memory tests in forksMike Bayer2017-08-141-0/+8
| | | | | | | | | | | | Swing the biggest hammer, run multiprocessing.Process() for each memusage test individually so that they are fully isolated from the parent process and any side effects of pytest-xdist Also add --nomemory as a shortcut to exclude_tags=memory-intensive and add this to the setup.py test runner as the memory tests should not be running for quick runs Change-Id: I3c16c781e21b33deb939a64e77a6e0e41fb86922
* Restore original test namesMike Bayer2017-08-141-4/+3
| | | | | | | | | | | The change in de1f8f8345ecd6af0ec1177703465e9471cfe862 modified how test classes are named, breaking logic that extracts the class name for the profiling suite. Add a new variable _sa_orig_cls_name if we've modified the name so that the profiling logic doesn't need to guess the original class name. Change-Id: Ica15a97408b9e0749a78c87f62749c15c1627009
* Allow multiple versions of single backendMike Bayer2017-08-041-2/+5
| | | | | | | | | | Improve screen output to illustrate which server version is running for a particular database config, and additionally allow full overriding for the backend-specific targets in tox.ini via environment variables, so that CI can inject multiple server urls for a particular database such as MySQL/MariaDB. Change-Id: Ibf443bb9fb82e4563efd1bb66058fa9989aa2fda
* update for 2017 copyrightMike Bayer2017-01-042-2/+2
| | | | Change-Id: I4e8c2aa8fe817bb2af8707410fa0201f938781de
* Additions to support HAAlchemy pluginMike Bayer2016-09-161-0/+1
| | | | | | | | | | | | | | | | | | | - add a connect=True key to connection record to support pre-loading of _ConnectionRecord objects - ensure _ConnectionRecord.close() leaves the record in a good state for reopening - add _ConnectionRecord.record_info for persistent storage - add "in_use" accessor based on fairy_ref being present or not - allow for the exclusions system and SuiteRequirements to be usable without the full plugin_base setup. - move some Python-env requirements to the importable requirements.py module. - allow starttime to be queried - add additional events for engine plugins - have "dialect" be a first-class parameter to the pool, ensure the engine strategy supplies it up front Change-Id: Ibf549f7a1766e49d335cd6f5e26bacfaef9a8229
* - limit oracle DB reaps to identifiers generated from thisMike Bayer2016-06-022-1/+13
| | | | | | run to prevent race conditions against concurrent runs Change-Id: I065d1cec346ea7af03792c3cc2f30766f73c2bd3
* - ensure engine is restored even if we had a failure in cleanupMike Bayer2016-03-151-3/+5
| | | | for stray connection
* - additional fixes to get oracle + multiprocess to be reliableMike Bayer2016-02-082-0/+11
|
* - happy new yearMike Bayer2016-01-292-2/+2
|
* - use uuid fragments for provision names to enable multiple test suitesMike Bayer2016-01-231-2/+2
| | | | per server
* - db_opts doesn't need to be a global since we no longer have any globalMike Bayer2015-07-171-5/+2
| | | | | option for it. keep it local to production of config so values don't leak in a multi --db situation.
* - move away from explicit raises of SkipTest, instead call aMike Bayer2015-05-013-10/+23
| | | | | | | function patched onto config. nose/pytest backends now fill in their exception class here only when loaded - use more public seeming api to get at py.test Skipped exception
* - Fixed an import that prevented "pypy setup.py test" from workingMike Bayer2015-05-011-0/+1
| | | | | correctly. fixes #3406
* - copyright 2015Mike Bayer2015-03-102-2/+2
|
* - add an exclusion here that helps with the case of 3rd partyMike Bayer2015-01-171-1/+2
| | | | test suite redefining an existing test in test_suite
* - test failures:Mike Bayer2015-01-021-1/+0
| | | | | - test_schema_2 is only on PG and doesn't need a drop all, omit this for now - py3k has exception.args[0], not message
* - repair drop_all_tablesMike Bayer2015-01-021-1/+1
|