diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2021-01-03 00:52:41 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2021-01-03 00:52:41 +0000 |
| commit | 1c35a3790c1f186b91d556fb161c1958cbf718bb (patch) | |
| tree | 6c8074a9f1b5d818e4faa679d52b5745cb86b7cc /test | |
| parent | 3f72c2c6cbc76506af57f136542f30bf68261898 (diff) | |
| parent | 5ba427f6daad4e7224267d11f7c6d99bd68f3d0e (diff) | |
| download | sqlalchemy-1c35a3790c1f186b91d556fb161c1958cbf718bb.tar.gz | |
Merge "Repair async test refactor"
Diffstat (limited to 'test')
| -rw-r--r-- | test/base/test_concurrency_py3k.py | 7 | ||||
| -rw-r--r-- | test/ext/asyncio/test_engine_py3k.py | 9 | ||||
| -rw-r--r-- | test/ext/asyncio/test_session_py3k.py | 4 |
3 files changed, 14 insertions, 6 deletions
diff --git a/test/base/test_concurrency_py3k.py b/test/base/test_concurrency_py3k.py index 2cc2075bc..e7ae8c9ad 100644 --- a/test/base/test_concurrency_py3k.py +++ b/test/base/test_concurrency_py3k.py @@ -26,7 +26,7 @@ def go(*fns): return sum(await_only(fn()) for fn in fns) -class TestAsyncioCompat(fixtures.AsyncTestBase): +class TestAsyncioCompat(fixtures.TestBase): @async_test async def test_ok(self): @@ -53,7 +53,8 @@ class TestAsyncioCompat(fixtures.AsyncTestBase): to_await = run1() await_fallback(to_await) - def test_await_only_no_greenlet(self): + @async_test + async def test_await_only_no_greenlet(self): to_await = run1() with expect_raises_message( exc.InvalidRequestError, @@ -62,7 +63,7 @@ class TestAsyncioCompat(fixtures.AsyncTestBase): await_only(to_await) # ensure no warning - await_fallback(to_await) + await greenlet_spawn(await_fallback, to_await) @async_test async def test_await_fallback_error(self): diff --git a/test/ext/asyncio/test_engine_py3k.py b/test/ext/asyncio/test_engine_py3k.py index cd1e16ed9..7dae1411e 100644 --- a/test/ext/asyncio/test_engine_py3k.py +++ b/test/ext/asyncio/test_engine_py3k.py @@ -17,6 +17,7 @@ from sqlalchemy.ext.asyncio import engine as _async_engine from sqlalchemy.ext.asyncio import exc as asyncio_exc from sqlalchemy.testing import async_test from sqlalchemy.testing import combinations +from sqlalchemy.testing import engines from sqlalchemy.testing import eq_ from sqlalchemy.testing import expect_raises from sqlalchemy.testing import expect_raises_message @@ -32,7 +33,7 @@ class EngineFixture(fixtures.TablesTest): @testing.fixture def async_engine(self): - return create_async_engine(testing.db.url) + return engines.testing_engine(asyncio=True) @classmethod def define_tables(cls, metadata): @@ -55,6 +56,12 @@ class EngineFixture(fixtures.TablesTest): class AsyncEngineTest(EngineFixture): __backend__ = True + @testing.fails("the failure is the test") + @async_test + async def test_we_are_definitely_running_async_tests(self, async_engine): + async with async_engine.connect() as conn: + eq_(await conn.scalar(text("select 1")), 2) + def test_proxied_attrs_engine(self, async_engine): sync_engine = async_engine.sync_engine diff --git a/test/ext/asyncio/test_session_py3k.py b/test/ext/asyncio/test_session_py3k.py index 37e1b807b..dbe84e82c 100644 --- a/test/ext/asyncio/test_session_py3k.py +++ b/test/ext/asyncio/test_session_py3k.py @@ -5,10 +5,10 @@ from sqlalchemy import select from sqlalchemy import testing from sqlalchemy import update from sqlalchemy.ext.asyncio import AsyncSession -from sqlalchemy.ext.asyncio import create_async_engine from sqlalchemy.orm import selectinload from sqlalchemy.orm import sessionmaker from sqlalchemy.testing import async_test +from sqlalchemy.testing import engines from sqlalchemy.testing import eq_ from sqlalchemy.testing import is_ from sqlalchemy.testing import mock @@ -24,7 +24,7 @@ class AsyncFixture(_fixtures.FixtureTest): @testing.fixture def async_engine(self): - return create_async_engine(testing.db.url) + return engines.testing_engine(asyncio=True) @testing.fixture def async_session(self, async_engine): |
