File tree Expand file tree Collapse file tree 3 files changed +20
-6
lines changed
Expand file tree Collapse file tree 3 files changed +20
-6
lines changed Original file line number Diff line number Diff line change 2525deps :
2626 @poetry install -E asyncpg -E aiomysql -E accel -E psycopg -E asyncodbc
2727
28+ deps_with_asyncmy :
29+ @poetry install -E asyncpg -E asyncmy -E accel -E psycopg -E asyncodbc
30+
2831check : deps build _check
2932_check :
3033ifneq ($(shell which black) ,)
@@ -67,13 +70,20 @@ test_mysql_myisam:
6770test_mysql :
6871 $(py_warn ) TORTOISE_TEST_DB=" mysql://root:$( TORTOISE_MYSQL_PASS) @127.0.0.1:3306/test_\{\}" pytest $(pytest_opts ) --cov-append --cov-report=
6972
73+ test_mysql_asyncmy :
74+ $(MAKE ) deps_with_asyncmy
75+ $(MAKE ) test_mysql
76+ # Restore dependencies to the default
77+ $(MAKE ) deps
78+
7079test_mssql :
7180 $(py_warn ) TORTOISE_TEST_DB=" mssql://sa:$( TORTOISE_MSSQL_PASS) @127.0.0.1:1433/test_\{\}?driver=$( TORTOISE_MSSQL_DRIVER) &TrustServerCertificate=YES" pytest $(pytest_opts ) --cov-append --cov-report=
7281
7382test_oracle :
7483 $(py_warn ) TORTOISE_TEST_DB=" oracle://SYSTEM:$( TORTOISE_ORACLE_PASS) @127.0.0.1:1521/test_\{\}?driver=$( TORTOISE_ORACLE_DRIVER) " pytest $(pytest_opts ) --cov-append --cov-report=
7584
76- _testall : test_sqlite test_postgres_asyncpg test_postgres_psycopg test_mysql_myisam test_mysql test_mssql
85+ _testall : test_sqlite test_postgres_asyncpg test_postgres_psycopg test_mysql_myisam test_mysql test_mysql_asyncmy test_mssql
86+
7787 coverage report
7888
7989testall : deps _testall
Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ Tortoise ORM currently supports the following databases:
152152
153153* `SQLite ` (requires ``aiosqlite ``)
154154* `PostgreSQL ` (requires ``asyncpg ``)
155- * `MySQL ` (requires ``asyncmy ``)
155+ * `MySQL ` (requires ``asyncmy `` or `` aiomysql `` )
156156* `Microsoft SQL Server `/`Oracle ` (requires ``asyncodbc ``)
157157
158158``generate_schema `` generates the schema on an empty database. Tortoise generates schemas in safe mode by default which
Original file line number Diff line number Diff line change @@ -29,11 +29,15 @@ async def test_bad_charset(self):
2929 async def test_ssl_true (self ):
3030 self .db_config ["connections" ]["models" ]["credentials" ]["ssl" ] = True
3131 try :
32- await Tortoise .init (self .db_config , _create_db = True )
33- except (ConnectionError , ssl .SSLError ):
32+ import asyncmy # noqa pylint: disable=unused-import
33+
34+ # setting read_timeout for asyncmy. Otherwise, it will hang forever.
35+ self .db_config ["connections" ]["models" ]["credentials" ]["read_timeout" ] = 1
36+ except ImportError :
3437 pass
35- else :
36- self .assertFalse (True , "Expected ConnectionError or SSLError" )
38+
39+ with self .assertRaises (ConnectionError ):
40+ await Tortoise .init (self .db_config , _create_db = True )
3741
3842 async def test_ssl_custom (self ):
3943 # Expect connectionerror or pass
You can’t perform that action at this time.
0 commit comments