summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/exclusions.py
Commit message (Collapse)AuthorAgeFilesLines
* fix incorrect use of testing.future()Mike Bayer2023-01-251-3/+2
| | | | | | | this has been emitting a warning probably for a long time Change-Id: I44a6766b5e92d14ce6bbb5a90ab52648f877afc2
* happy new year 2023Mike Bayer2023-01-031-1/+1
| | | | Change-Id: I625af65b3fb1815b1af17dc2ef47dd697fdc3fb1
* Try running pyupgrade on the codeFederico Caselli2022-11-161-4/+2
| | | | | | | | command run is "pyupgrade --py37-plus --keep-runtime-typing --keep-percent-format <files...>" pyupgrade will change assert_ to assertTrue. That was reverted since assertTrue does not exists in sqlalchemy fixtures Change-Id: Ie1ed2675c7b11d893d78e028aad0d1576baebb55
* inline mypy config; files ignoring type errors for the momentMike Bayer2022-04-281-1/+1
| | | | | | | | | | | | | | | | | | | 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
* replace test tags with pytest.markMike Bayer2022-01-251-22/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | replaced the __tags__ class attribute and the --exclude-tags / --include-tags test runner options with regular pytest.mark names so that we can take advantage of mark expressions. options --nomemory, --notimingintensive, --backend-only, --exclude-tags, --include-tags remain as legacy but make use of pytest mark for implemementation. Added a "mypy" mark for the section of tests that are doing mypy integration tests. The __backend__ and __sparse_backend__ class attributes also use pytest marks for their implementation, which also allows the marks "backend" and "sparse_backend" to be used explicitly. Also removed the no longer used "--cdecimal" option as this was python 2 specific. in theory, the usage of pytest marks could expand such that the whole exclusions system would be based on it, but this does not seem to have any advantage at the moment. Change-Id: Ideeb57d9d49f0efc7fc0b6b923b31207ab783025
* happy new year 2022Mike Bayer2022-01-061-1/+1
| | | | Change-Id: I49abf2607e0eb0623650efdf0091b1fb3db737ea
* Replace raise_ with raise fromFederico Caselli2021-12-271-1/+1
| | | | | Change-Id: I7aaeb5bc130271624335b79cf586581d6c6c34c7 References: #4600
* Clean up most py3k compatFederico Caselli2021-11-241-1/+1
| | | | Change-Id: I8172fdcc3103ff92aa049827728484c8779af6b7
* Remove object in class definitionFederico Caselli2021-11-221-2/+2
| | | | | References: #4600 Change-Id: I2a62ddfe00bc562720f0eae700a497495d7a987a
* First round of removal of python 2Federico Caselli2021-11-011-7/+1
| | | | | References: #4600 Change-Id: I61e35bc93fe95610ae75b31c18a3282558cd4ffe
* 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
* set identifier length for MySQL constraints to 64Mike Bayer2021-01-301-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | The rule to limit index names to 64 also applies to all DDL names, such as those coming from naming conventions. Add another limiting variable for constraint names and create test cases against all constraint types. Additionally, codified in the test suite MySQL's lack of support for naming of a FOREIGN KEY constraint after the name was given, which apparently assigns the name to an associated KEY but not the constraint itself, until MySQL 8 and MariaDB 10.5 which appear to have resolved the behavior. However it's not clear how Alembic hasn't had issues reported with this so far. Fixed long-lived bug in MySQL dialect where the maximum identifier length of 255 was too long for names of all types of constraints, not just indexes, all of which have a size limit of 64. As metadata naming conventions can create too-long names in this area, apply the limit to the identifier generator within the DDL compiler. Fixes: #5898 Change-Id: I79549474845dc29922275cf13321c07598dcea08
* happy new yearMike Bayer2021-01-041-1/+1
| | | | Change-Id: Ic5bb19ca8be3cb47c95a0d3315d84cb484bac47c
* Provision on different drivers dynamicallyMike Bayer2020-08-141-0/+3
| | | | | | | | | | | We want TOX_POSTGRESQL and similar to be the fixed variable that is configured from CI environment. These variables should refer to database servers but individual drivers like asyncpg mysqlconnector etc. should come from local tox.ini. add a new system to generate per-driver URLs from a simple list of hostname-based URLs delivered from CI environment. Change-Id: I4267b4a70742765388c7e7c4432c1da9d9adece2
* Ensure all nested exception throws have a causeMike Bayer2020-03-021-1/+2
| | | | | | | | | | | | | | | Applied an explicit "cause" to most if not all internally raised exceptions that are raised from within an internal exception catch, to avoid misleading stacktraces that suggest an error within the handling of an exception. While it would be preferable to suppress the internally caught exception in the way that the ``__suppress_context__`` attribute would, there does not as yet seem to be a way to do this without suppressing an enclosing user constructed context, so for now it exposes the internally caught exception as the cause so that full information about the context of the error is maintained. Fixes: #4849 Change-Id: I55a86b29023675d9e5e49bc7edc5a2dc0bcd4751
* Rework combination exclusionsMike Bayer2020-02-101-36/+9
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Enable F821Mike Bayer2020-01-041-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In Ia63a510f9c1d08b055eef62cf047f1f427f0450c we introduced "lambda combinations" which use a bit of function closure inspection in order to allow for testing combinations that make use of symbols that come from test fixtures, or from the test itself. Two problems. One is that we can't use F821 flake8 rule without either adding lots of noqas, skipping the file, or adding arguments to the lambdas themselves that are then populated, which makes for a very verbose system. The other is that the system is already verbose with all those lambdas and the magic in use is a non-explicit kind, hence F821 reminds us that if we can improve upon this, we should. So let's improve upon it by making it so that the "lambda" is just once and up front for the whole thing, and let it accept the arguments directly. This still requires magic, because these test cases need to resolve at test collection time, not test runtime. But we will instead substitute a namespace up front that can be coerced into its desired form within the tests. Additionally, there's a little bit of py2k compatible type annotations present; f821 is checking these, so we have to add those imports also using the TYPE_CHECKING boolean so they don't take place in py2k. Change-Id: Idb7e7a0c8af86d9ab133f548511306ef68cdba14
* happy new yearMike Bayer2020-01-011-1/+1
| | | | Change-Id: I08440dc25e40ea1ccea1778f6ee9e28a00808235
* Test fixture improvementsMike Bayer2019-11-111-1/+4
| | | | | | | | | | - 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-10/+41
| | | | | | | | | | | 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
* Fix exclusions for multiple fails_onMike Bayer2019-11-091-11/+10
| | | | | | | | | | | | | | The fails_on decorator was not being interpreted correctly when multiple were present. Remove obsolete fails_on from test_types that no longer take place for MySQL, Oracle. Ensure test_types tests are using __backend__ mark currently failing Oracle interval tests Change-Id: If8db0c02b31a8008fd1673c2380f1f974c3806a6
* Remove unnecessary util.callable usageSteven Loria2019-09-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes: #4850 <!-- Provide a general summary of your proposed changes in the Title field above --> ### Description <!-- Describe your changes in detail --> Removes usage of `util.callable`. ### Checklist <!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once) --> This pull request is: - [ ] A documentation / typographical error fix - Good to go, no issue or tests are needed - [x] A short code fix - please include the issue number, and create an issue if none exists, which must include a complete example of the issue. one line code fixes without an issue and demonstration will not be accepted. - Please include: `Fixes: #<issue number>` in the commit message - please include tests. one line code fixes without tests will not be accepted. - [ ] A new feature implementation - please include the issue number, and create an issue if none exists, which must include a complete example of how the feature would look. - Please include: `Fixes: #<issue number>` in the commit message - please include tests. **Have a nice day!** Closes: #4851 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4851 Pull-request-sha: a0ccdff2cb74f5e944d8baccc269c382b591c8e2 Change-Id: I79918f44becbc5dbefdc7ff65128695c1cabed1d
* move to inspect_getfullargspecMike Bayer2019-01-151-2/+2
| | | | | | | | Replace inspect_getargspec with inspect_getfullargspec including a compatibility fallback for Py2k and use getfullargspec fully. Change-Id: I92bce0aafc37ce1a360b4f61b75f5892d0911c7e
* happy new yearMike Bayer2019-01-111-1/+1
| | | | Change-Id: I6a71f4924d046cf306961c58dffccf21e9c03911
* Post black reformattingMike Bayer2019-01-061-3/+2
| | | | | | | | | | | | | 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-061-64/+59
| | | | | | | | | | | | | | 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
* rework the exclusions spec expressionMike Bayer2018-12-311-12/+18
| | | | | | | The expression was expecting spaces which means we were skipping Postgresql window function tests and possibly other things. Change-Id: I57c4aed558f4011f2f7b882a2d9b1fee210f9eaf
* Default server_version_info to (0, )Mike Bayer2018-05-111-1/+3
| | | | | | | | | 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
* happy new yearMike Bayer2018-01-121-1/+1
| | | | Change-Id: I3ef36bfd0cb0ba62b3123c8cf92370a43156cf8f
* - a few mysql fixes, more to comeMike Bayer2017-08-201-3/+4
| | | | Change-Id: Icdcc8ed03374251b8d3815ae58e2726ea27c14b4
* update for 2017 copyrightMike Bayer2017-01-041-1/+1
| | | | Change-Id: I4e8c2aa8fe817bb2af8707410fa0201f938781de
* Additions to support HAAlchemy pluginMike Bayer2016-09-161-7/+9
| | | | | | | | | | | | | | | | | | | - 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
* - happy new yearMike Bayer2016-01-291-1/+1
|
* - Fixed bug where use of the :meth:`.Query.select_from` method wouldMike Bayer2015-12-121-2/+2
| | | | | | cause a subsequent call to the :meth:`.Query.with_parent` method to fail. fixes #3606 - add mark-as-fail test for #3607
* Update usages of getargspec to compat version.pr/210Jacob MacDonald2015-10-291-1/+2
| | | | | The places inspect.getargspec was being used were causing problems for newer Python versions.
* - fix the postgresql_jsonb requirement to include the 9.4 requirementMike Bayer2015-08-181-3/+3
| | | | | | | | - new test for json col['x']['y']['z'] seems to fail pre PG 9.4, fails on comparisons for non-compatible data instead of not matching - no need to call SpecPredicate(db) directly in exclusion functions, by using Predicate.as_predicate() the spec strings can have version comparisons
* - move away from explicit raises of SkipTest, instead call aMike Bayer2015-05-011-2/+1
| | | | | | | 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
* - copyright 2015Mike Bayer2015-03-101-1/+1
|
* - enhance only_on() to work with compound specsMike Bayer2014-12-061-1/+1
| | | | - fix "temporary_tables" requirement
* - embedding an existing predicate into a new one onlyMike Bayer2014-10-111-2/+1
| | | | | | seems to be used by test_oracle->test_coerce_to_unicode(). The predicate here should treat as a lambda based on enabled_for_config. not sure why this test is not failing on jenkins
* - raise from cause here to preserve stack traceMike Bayer2014-09-161-1/+1
|
* - add support for tags, including include/exclude support.Mike Bayer2014-07-271-7/+27
| | | | simplify tox again now that we can exclude tests more easily
* - rework the exclusions system to have much better support for compoundMike Bayer2014-07-261-110/+164
| | | | rules, better message formatting
* - apply pep8 formatting to sqlalchemy/sql, sqlalchemy/util, sqlalchemy/dialects,Brian Jarrett2014-07-201-32/+36
| | | | sqlalchemy/orm, sqlalchemy/event, sqlalchemy/testing
* - break up the <authors> copyright comment as part of a passMike Bayer2014-07-091-1/+2
| | | | to get all flake8 passing
* - Fixed ORM bug where changing the primary key of an object, then markingMike Bayer2014-03-281-0/+3
| | | | | | | | | | | | | it for DELETE would fail to target the correct row for DELETE. Then to compound matters, basic "number of rows matched" checks were not being performed. Both issues are fixed, however note that the "rows matched" check requires so-called "sane multi-row count" functionality; the DBAPI's executemany() method must count up the rows matched by individual statements and SQLAlchemy's dialect must mark this feature as supported, currently applies to some mysql dialects, psycopg2, sqlite only. fixes #3006 - Enabled "sane multi-row count" checking for the psycopg2 DBAPI, as this seems to be supported as of psycopg2 2.0.9.
* - add more support for suite tests, moving some tests from test_query out to ↵Mike Bayer2014-03-131-0/+2
| | | | | | suite and adding some more requirements
* - cx_oracle test for "unicode returns" needs to be cx_oracle only,Mike Bayer2014-03-061-2/+2
| | | | | | | and also will fail on py3k. - enhance exclusions so that a requirement attribute can be passed to fails_if/skip_if. - fix coverage docs to mention pytest.
* - Support has been added for pytest to run tests. This runnerMike Bayer2014-03-031-25/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | is currently being supported in addition to nose, and will likely be preferred to nose going forward. The nose plugin system used by SQLAlchemy has been split out so that it works under pytest as well. There are no plans to drop support for nose at the moment and we hope that the test suite itself can continue to remain as agnostic of testing platform as possible. See the file README.unittests.rst for updated information on running tests with pytest. The test plugin system has also been enhanced to support running tests against mutiple database URLs at once, by specifying the ``--db`` and/or ``--dburi`` flags multiple times. This does not run the entire test suite for each database, but instead allows test cases that are specific to certain backends make use of that backend as the test is run. When using pytest as the test runner, the system will also run specific test suites multiple times, once for each database, particularly those tests within the "dialect suite". The plan is that the enhanced system will also be used by Alembic, and allow Alembic to run migration operation tests against multiple backends in one run, including third-party backends not included within Alembic itself. Third party dialects and extensions are also encouraged to standardize on SQLAlchemy's test suite as a basis; see the file README.dialects.rst for background on building out from SQLAlchemy's test platform.
* - happy new yearMike Bayer2014-01-051-1/+1
|