Skip to content

Commit 79143ed

Browse files
feat: add sqlalchemy tests (#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]>
1 parent 816db70 commit 79143ed

File tree

5 files changed

+166
-0
lines changed

5 files changed

+166
-0
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
from sqlalchemy.testing.requirements import SuiteRequirements
2+
3+
from sqlalchemy.testing import exclusions
4+
5+
6+
class Requirements(SuiteRequirements):
7+
@property
8+
def bound_limit_offset(self):
9+
return exclusions.closed()
10+
11+
@property
12+
def date(self):
13+
return exclusions.closed()
14+
15+
@property
16+
def datetime_microseconds(self):
17+
return exclusions.closed()
18+
19+
@property
20+
def floats_to_four_decimals(self):
21+
return exclusions.closed()
22+
23+
# TODO: remove this when SQLA released with
24+
# https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/2990
25+
@property
26+
def implicitly_named_constraints(self):
27+
return exclusions.open()
28+
29+
@property
30+
def nullable_booleans(self):
31+
"""Target database allows boolean columns to store NULL."""
32+
# Access Yes/No doesn't allow null
33+
return exclusions.closed()
34+
35+
@property
36+
def offset(self):
37+
# Access does LIMIT (via TOP) but not OFFSET
38+
return exclusions.closed()
39+
40+
@property
41+
def parens_in_union_contained_select_w_limit_offset(self):
42+
return exclusions.closed()
43+
44+
@property
45+
def precision_generic_float_type(self):
46+
return exclusions.closed()
47+
48+
@property
49+
def reflects_pk_names(self):
50+
return exclusions.open()
51+
52+
@property
53+
def sql_expression_limit_offset(self):
54+
return exclusions.closed()
55+
56+
@property
57+
def temp_table_reflection(self):
58+
return exclusions.closed()
59+
60+
@property
61+
def temporary_tables(self):
62+
return exclusions.closed()
63+
64+
@property
65+
def temporary_views(self):
66+
return exclusions.closed()
67+
68+
@property
69+
def time(self):
70+
return exclusions.closed()
71+
72+
@property
73+
def time_microseconds(self):
74+
return exclusions.closed()
75+
76+
@property
77+
def timestamp_microseconds(self):
78+
return exclusions.closed()
79+
80+
@property
81+
def unicode_ddl(self):
82+
# Access won't let you drop a child table unless
83+
# you drop the FK constraint first. Not worth the grief.
84+
return exclusions.closed()
85+
86+
@property
87+
def view_column_reflection(self):
88+
return exclusions.open()
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
# Copyright 2021 4Paradigm
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# [tool:pytest]
18+
# addopts= --tb native -v -r fxX --maxfail=25 -p no:warnings
19+
# python_files=/openmldb/test/*test_*.py
20+
21+
# [sqla_testing]
22+
# requirement_cls=openmldb.sqlalchemy_openmldb.requirements:Requirements
23+
# profile_file=test/profiles.txt
24+
25+
# [db]
26+
# default = openmldb:///db_test?zk=127.0.0.1:6181&zkPath=/onebox

python/openmldb/test/conftest.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
# Copyright 2021 4Paradigm
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
from sqlalchemy.dialects import registry
18+
import pytest
19+
20+
# registry.register("openmldb", "openmldb.sqlalchemy_openmldb.openmldb_dialect", "OpenmldbDialect")
21+
22+
# pytest.register_assert_rewrite("sqlalchemy.testing.assertions")
23+
24+
# from sqlalchemy.testing.plugin.pytestplugin import *
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
# Copyright 2021 4Paradigm
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
from sqlalchemy.testing.suite import *
18+
19+
from sqlalchemy.testing.suite import IntegerTest as _IntegerTest
20+
21+
# class IntegerTest(_IntegerTest):
22+
23+
# @testing.skip("access")
24+
# def test_huge_int(self):
25+
# # bypass this test because Access ODBC fails with
26+
# # [ODBC Microsoft Access Driver] Optional feature not implemented.
27+
# return

python/setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"sqlalchemy < 1.4.0",
3232
"IPython",
3333
"prettytable",
34+
"tox",
3435
"pytest"
3536
],
3637
include_package_data=True,

0 commit comments

Comments
 (0)