tigrbl-tests 0.3.3.dev1__py3-none-any.whl → 0.3.3.dev2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,27 @@
1
+ import asyncio
2
+
3
+ import pytest
4
+ from sqlalchemy import Column, Integer
5
+
6
+ from tigrbl import Base, TigrblApp
7
+ from tigrbl.engine.shortcuts import mem
8
+
9
+
10
+ class Widget(Base):
11
+ __tablename__ = "widgets_async_task"
12
+
13
+ id = Column(Integer, primary_key=True)
14
+
15
+
16
+ @pytest.mark.asyncio
17
+ async def test_initialize_returns_task_for_async_engine():
18
+ app = TigrblApp(engine=mem())
19
+ app.include_model(Widget, prefix="")
20
+
21
+ result = app.initialize()
22
+
23
+ assert isinstance(result, asyncio.Task)
24
+
25
+ await result
26
+
27
+ assert getattr(app, "_ddl_executed", False) is True
@@ -0,0 +1,41 @@
1
+ import asyncio
2
+
3
+ import pytest
4
+ from sqlalchemy import Column, Integer
5
+
6
+ from tigrbl import Base, TigrblApi, TigrblApp
7
+ from tigrbl.engine.shortcuts import mem
8
+
9
+
10
+ class AsyncWidget(Base):
11
+ __tablename__ = "widgets_async_api"
12
+
13
+ id = Column(Integer, primary_key=True)
14
+
15
+
16
+ class SyncWidget(Base):
17
+ __tablename__ = "widgets_sync_api"
18
+
19
+ id = Column(Integer, primary_key=True)
20
+
21
+
22
+ @pytest.mark.asyncio
23
+ async def test_initialize_handles_mixed_sync_async_apis():
24
+ async_api = TigrblApi(engine=mem())
25
+ async_api.include_model(AsyncWidget, prefix="")
26
+
27
+ sync_api = TigrblApi(engine=mem(async_=False))
28
+ sync_api.include_model(SyncWidget, prefix="")
29
+
30
+ app = TigrblApp(engine=mem(async_=False))
31
+ app.include_apis([async_api, sync_api])
32
+
33
+ result = app.initialize()
34
+
35
+ assert isinstance(result, asyncio.Task)
36
+
37
+ await result
38
+
39
+ assert getattr(app, "_ddl_executed", False) is True
40
+ assert getattr(async_api, "_ddl_executed", False) is True
41
+ assert getattr(sync_api, "_ddl_executed", False) is True
@@ -0,0 +1,27 @@
1
+ import asyncio
2
+
3
+ import pytest
4
+ from sqlalchemy import Column, Integer
5
+
6
+ from tigrbl import Base, TigrblApp
7
+ from tigrbl.engine.shortcuts import mem
8
+
9
+
10
+ class Widget(Base):
11
+ __tablename__ = "widgets"
12
+
13
+ id = Column(Integer, primary_key=True)
14
+
15
+
16
+ @pytest.mark.asyncio
17
+ async def test_initialize_schedules_task_for_sync_engine():
18
+ api = TigrblApp(engine=mem(async_=False))
19
+ api.models["Widget"] = Widget
20
+
21
+ result = api.initialize()
22
+
23
+ assert isinstance(result, asyncio.Task)
24
+
25
+ await result
26
+
27
+ assert getattr(api, "_ddl_executed", False) is True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tigrbl-tests
3
- Version: 0.3.3.dev1
3
+ Version: 0.3.3.dev2
4
4
  Summary: Test suite and fixtures for the Tigrbl framework.
5
5
  License-Expression: Apache-2.0
6
6
  License-File: LICENSE
@@ -119,7 +119,10 @@ tests/unit/test_hybrid_session_run_sync.py,sha256=6zidxhpUNfE81xtS5kzQYPn36SinMP
119
119
  tests/unit/test_in_tx.py,sha256=Bzn5iTkJGUpXG8J0Uduj9b8OThgPGXl-jEKfmWyWkPY,549
120
120
  tests/unit/test_include_model_columns_namespace.py,sha256=IQhuCZ168NanMHiTlhs_B1seQwYIkaq3WaBqiWkC67c,591
121
121
  tests/unit/test_include_models_base_prefix.py,sha256=z8Rvl3bMjf8kMLpqLn7Ia08dR1KQORrHzBIrubyEq8s,813
122
+ tests/unit/test_initialize_async_task.py,sha256=Q2VNj6WR9DAN_niM3g1r-K8bDkRcFB4whrwG1gaviBg,560
122
123
  tests/unit/test_initialize_cross_ddl.py,sha256=kaku7ZVX68rDAxNBbZRaVyXSiw4Op6Jb5ex-eNHKmjU,689
124
+ tests/unit/test_initialize_mixed_engines.py,sha256=kQPUAsfOUwcbz3FPMaMuDQpyBIG4q_DvuC9Vye7mIvo,1017
125
+ tests/unit/test_initialize_task_schedule.py,sha256=OLMjubgyOxglRv2vtB6gicEK3_6WuYasZRftIPJ5sMw,555
123
126
  tests/unit/test_io_spec_attributes.py,sha256=Da9u7yjw-KVbHF1tpQhUvl7HSfooe9L1k5y-ceRVsaM,5662
124
127
  tests/unit/test_iospec_attributes.py,sha256=Xl5jOHBVJH4gmZqznaVrO3trqnwWYtztwRIryAnKsJo,2254
125
128
  tests/unit/test_iospec_effects.py,sha256=frPnZNX3_dVqmG_b4rUCrrJRzGQ6JzHKCZm0GsM-csA,5687
@@ -208,7 +211,7 @@ tests/unit/test_v3_op_ctx_attributes.py,sha256=ygRtYSYYtDFCTIRVHX2DFYTliP15NcmVi
208
211
  tests/unit/test_v3_schemas_and_decorators.py,sha256=1wmg7pmzQNjjbQPRjO8gkCM6BQpMRbeO2jmtDMSYXLU,3818
209
212
  tests/unit/test_v3_storage_spec_attributes.py,sha256=iXpjD4GlLddhJ_jC2veND2s6usXdOm-S9sKKfQl9XK0,6540
210
213
  tests/unit/test_verbosity.py,sha256=92dIDc-LBIzjR1d90aL077R29rYJztibKYQGTjI6G68,1945
211
- tigrbl_tests-0.3.3.dev1.dist-info/METADATA,sha256=mE6ccLvpw3lzMwkPIGP6iXuag8tRJCy3OkkXdpo7iqg,3892
212
- tigrbl_tests-0.3.3.dev1.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
213
- tigrbl_tests-0.3.3.dev1.dist-info/licenses/LICENSE,sha256=djUXOlCxLVszShEpZXshZ7v33G-2qIC_j9KXpWKZSzQ,11359
214
- tigrbl_tests-0.3.3.dev1.dist-info/RECORD,,
214
+ tigrbl_tests-0.3.3.dev2.dist-info/METADATA,sha256=RnymQpVh0nnTDiVIy_ODlatjs5q6Otou6D4rlXNZDis,3892
215
+ tigrbl_tests-0.3.3.dev2.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
216
+ tigrbl_tests-0.3.3.dev2.dist-info/licenses/LICENSE,sha256=djUXOlCxLVszShEpZXshZ7v33G-2qIC_j9KXpWKZSzQ,11359
217
+ tigrbl_tests-0.3.3.dev2.dist-info/RECORD,,