forked from 4paradigm/OpenMLDB
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add sqlalchemy tests (4paradigm#1756)
* Create requirements.py * Create setup.cfg * Create conftest.py * Update conftest.py * Create sqlalchemy_standardtest_example.py * Update setup.py * Update sqlalchemy_standardtest_example.py * Update setup.cfg * Rename setup.cfg to sqlalchemy_test_config * Update conftest.py Co-authored-by: HuilinWu2 <[email protected]>
- Loading branch information
1 parent
816db70
commit 79143ed
Showing
5 changed files
with
166 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,88 @@ | ||
from sqlalchemy.testing.requirements import SuiteRequirements | ||
|
||
from sqlalchemy.testing import exclusions | ||
|
||
|
||
class Requirements(SuiteRequirements): | ||
@property | ||
def bound_limit_offset(self): | ||
return exclusions.closed() | ||
|
||
@property | ||
def date(self): | ||
return exclusions.closed() | ||
|
||
@property | ||
def datetime_microseconds(self): | ||
return exclusions.closed() | ||
|
||
@property | ||
def floats_to_four_decimals(self): | ||
return exclusions.closed() | ||
|
||
# TODO: remove this when SQLA released with | ||
# https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/2990 | ||
@property | ||
def implicitly_named_constraints(self): | ||
return exclusions.open() | ||
|
||
@property | ||
def nullable_booleans(self): | ||
"""Target database allows boolean columns to store NULL.""" | ||
# Access Yes/No doesn't allow null | ||
return exclusions.closed() | ||
|
||
@property | ||
def offset(self): | ||
# Access does LIMIT (via TOP) but not OFFSET | ||
return exclusions.closed() | ||
|
||
@property | ||
def parens_in_union_contained_select_w_limit_offset(self): | ||
return exclusions.closed() | ||
|
||
@property | ||
def precision_generic_float_type(self): | ||
return exclusions.closed() | ||
|
||
@property | ||
def reflects_pk_names(self): | ||
return exclusions.open() | ||
|
||
@property | ||
def sql_expression_limit_offset(self): | ||
return exclusions.closed() | ||
|
||
@property | ||
def temp_table_reflection(self): | ||
return exclusions.closed() | ||
|
||
@property | ||
def temporary_tables(self): | ||
return exclusions.closed() | ||
|
||
@property | ||
def temporary_views(self): | ||
return exclusions.closed() | ||
|
||
@property | ||
def time(self): | ||
return exclusions.closed() | ||
|
||
@property | ||
def time_microseconds(self): | ||
return exclusions.closed() | ||
|
||
@property | ||
def timestamp_microseconds(self): | ||
return exclusions.closed() | ||
|
||
@property | ||
def unicode_ddl(self): | ||
# Access won't let you drop a child table unless | ||
# you drop the FK constraint first. Not worth the grief. | ||
return exclusions.closed() | ||
|
||
@property | ||
def view_column_reflection(self): | ||
return exclusions.open() |
This file contains 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,26 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2021 4Paradigm | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# [tool:pytest] | ||
# addopts= --tb native -v -r fxX --maxfail=25 -p no:warnings | ||
# python_files=/openmldb/test/*test_*.py | ||
|
||
# [sqla_testing] | ||
# requirement_cls=openmldb.sqlalchemy_openmldb.requirements:Requirements | ||
# profile_file=test/profiles.txt | ||
|
||
# [db] | ||
# default = openmldb:///db_test?zk=127.0.0.1:6181&zkPath=/onebox |
This file contains 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,24 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2021 4Paradigm | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from sqlalchemy.dialects import registry | ||
import pytest | ||
|
||
# registry.register("openmldb", "openmldb.sqlalchemy_openmldb.openmldb_dialect", "OpenmldbDialect") | ||
|
||
# pytest.register_assert_rewrite("sqlalchemy.testing.assertions") | ||
|
||
# from sqlalchemy.testing.plugin.pytestplugin import * |
This file contains 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,27 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2021 4Paradigm | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from sqlalchemy.testing.suite import * | ||
|
||
from sqlalchemy.testing.suite import IntegerTest as _IntegerTest | ||
|
||
# class IntegerTest(_IntegerTest): | ||
|
||
# @testing.skip("access") | ||
# def test_huge_int(self): | ||
# # bypass this test because Access ODBC fails with | ||
# # [ODBC Microsoft Access Driver] Optional feature not implemented. | ||
# return |
This file contains 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 |
---|---|---|
|
@@ -31,6 +31,7 @@ | |
"sqlalchemy < 1.4.0", | ||
"IPython", | ||
"prettytable", | ||
"tox", | ||
"pytest" | ||
], | ||
include_package_data=True, | ||
|