-
Notifications
You must be signed in to change notification settings - Fork 713
TST: Refactoring backend tests #2566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8b3f4a4
TST: Refactoring backend tests
datapythonista dd8d12c
Merge remote-tracking branch 'upstream/master' into backend_tests
datapythonista bceaf58
Fixing CI
datapythonista f5c71ab
Fixing relative path
datapythonista ee17068
isort
datapythonista d1053a1
Merge remote-tracking branch 'upstream/master' into backend_tests
datapythonista File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import os | ||
| from pathlib import Path | ||
|
|
||
| from pkg_resources import parse_version | ||
|
|
||
| import ibis | ||
| from ibis.backends.tests.base import BackendTest, RoundHalfToEven | ||
|
|
||
|
|
||
| class MySQLTest(BackendTest, RoundHalfToEven): | ||
| # mysql has the same rounding behavior as postgres | ||
| check_dtype = False | ||
| supports_window_operations = False | ||
| returned_timestamp_unit = 's' | ||
|
|
||
| def __init__(self, data_directory: Path) -> None: | ||
| super().__init__(data_directory) | ||
| # mariadb supports window operations after version 10.2 | ||
| # but the sqlalchemy version string looks like: | ||
| # 5.5.5.10.2.12.MariaDB.10.2.12+maria~jessie | ||
| # or 10.4.12.MariaDB.1:10.4.12+maria~bionic | ||
| # example of possible results: | ||
| # https://github.com/sqlalchemy/sqlalchemy/blob/rel_1_3/ | ||
| # test/dialect/mysql/test_dialect.py#L244-L268 | ||
| con = self.connection | ||
| if 'MariaDB' in str(con.version): | ||
| # we might move this parsing step to the mysql client | ||
| version_detail = con.con.dialect._parse_server_version( | ||
| str(con.version) | ||
| ) | ||
| version = ( | ||
| version_detail[:3] | ||
| if version_detail[3] == 'MariaDB' | ||
| else version_detail[3:6] | ||
| ) | ||
| self.__class__.supports_window_operations = version >= (10, 2) | ||
| elif con.version >= parse_version('8.0'): | ||
| # mysql supports window operations after version 8 | ||
| self.__class__.supports_window_operations = True | ||
|
|
||
| @staticmethod | ||
| def connect(data_directory: Path) -> ibis.client.Client: | ||
| user = os.environ.get('IBIS_TEST_MYSQL_USER', 'ibis') | ||
| password = os.environ.get('IBIS_TEST_MYSQL_PASSWORD', 'ibis') | ||
| host = os.environ.get('IBIS_TEST_MYSQL_HOST', 'localhost') | ||
| port = os.environ.get('IBIS_TEST_MYSQL_PORT', 3306) | ||
| database = os.environ.get('IBIS_TEST_MYSQL_DATABASE', 'ibis_testing') | ||
| return ibis.mysql.connect( | ||
| host=host, | ||
| port=port, | ||
| user=user, | ||
| password=password, | ||
| database=database, | ||
| ) | ||
|
|
||
| @property | ||
| def functional_alltypes(self): | ||
| # BOOLEAN <-> TINYINT(1) | ||
| t = super().functional_alltypes | ||
| return t.mutate(bool_col=t.bool_col == 1) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.