From 497e1445126a4cd5f0f658d8163e9b3874523b65 Mon Sep 17 00:00:00 2001 From: Adam Watkins Date: Wed, 5 Jan 2022 11:01:55 -0800 Subject: [PATCH 1/6] :alembic: Add py.typed file --- fastapi_crudrouter/py.typed | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 fastapi_crudrouter/py.typed diff --git a/fastapi_crudrouter/py.typed b/fastapi_crudrouter/py.typed new file mode 100644 index 0000000..e69de29 From 743eecc1910ac48d5c758f01a9cef55032e25bc9 Mon Sep 17 00:00:00 2001 From: Adam Watkins Date: Wed, 5 Jan 2022 11:39:19 -0800 Subject: [PATCH 2/6] :alembic: Add py.typed integration tests --- tests/test_integration/test_typing.py | 33 +++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/test_integration/test_typing.py diff --git a/tests/test_integration/test_typing.py b/tests/test_integration/test_typing.py new file mode 100644 index 0000000..b8aa9c2 --- /dev/null +++ b/tests/test_integration/test_typing.py @@ -0,0 +1,33 @@ +import pathlib + +file = pathlib.Path(__file__) +package = file.parent.parent.parent / "fastapi_crudrouter" + + +def test_py_typed_file_exists(): + assert (package / "py.typed").exists() + assert (package / "py.typed").is_file() + + +def test_virtualenv(virtualenv): + assert (package).exists() + + virtualenv.run(f"pip install -e {package}") + virtualenv.run(f"pip install mypy") + virtualenv.run(f"mypy {file}") + + +if __name__ == "__main__": + from pydantic import BaseModel + from fastapi import FastAPI + + import fastapi_crudrouter + + class User(BaseModel): + id: int + name: str + email: str + + router = fastapi_crudrouter.MemoryCRUDRouter(schema=User) + app = FastAPI() + app.include_router(router) From 9d22ac4c988753ee19cac1ed240cf2bb3ce7d3d7 Mon Sep 17 00:00:00 2001 From: Adam Watkins Date: Wed, 5 Jan 2022 12:10:38 -0800 Subject: [PATCH 3/6] :alembic: Add py.typed integration tests --- tests/test_integration/test_typing.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/test_integration/test_typing.py b/tests/test_integration/test_typing.py index b8aa9c2..833e6c0 100644 --- a/tests/test_integration/test_typing.py +++ b/tests/test_integration/test_typing.py @@ -1,18 +1,20 @@ import pathlib file = pathlib.Path(__file__) -package = file.parent.parent.parent / "fastapi_crudrouter" +root_dir = file.parent.parent.parent +package_src = root_dir / "fastapi_crudrouter" def test_py_typed_file_exists(): - assert (package / "py.typed").exists() - assert (package / "py.typed").is_file() + assert (package_src / "py.typed").exists() + assert (package_src / "py.typed").is_file() def test_virtualenv(virtualenv): - assert (package).exists() + assert (root_dir).exists() + assert (root_dir / "setup.py").exists() - virtualenv.run(f"pip install -e {package}") + virtualenv.run(f"pip install -e {root_dir}") virtualenv.run(f"pip install mypy") virtualenv.run(f"mypy {file}") From 7b8edf6045fe5f19a8b19477a2657889648a922e Mon Sep 17 00:00:00 2001 From: Adam Watkins Date: Wed, 5 Jan 2022 17:34:07 -0800 Subject: [PATCH 4/6] :pushpin: Pin TortoiseORM to 0.17.8 in tests --- tests/dev.requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/dev.requirements.txt b/tests/dev.requirements.txt index 83f713b..427cc2f 100644 --- a/tests/dev.requirements.txt +++ b/tests/dev.requirements.txt @@ -4,7 +4,7 @@ async-exit-stack; python_version=='3.6' # Backends ormar -tortoise-orm +tortoise-orm=0.17.8 databases aiosqlite sqlalchemy==1.3.22 From 155996601f438d57e18242c5a1724fdd579a9bed Mon Sep 17 00:00:00 2001 From: Adam Watkins Date: Wed, 5 Jan 2022 17:35:56 -0800 Subject: [PATCH 5/6] :pushpin: Pin TortoiseORM to 0.17.8 in tests --- tests/dev.requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/dev.requirements.txt b/tests/dev.requirements.txt index 427cc2f..8fed333 100644 --- a/tests/dev.requirements.txt +++ b/tests/dev.requirements.txt @@ -4,7 +4,7 @@ async-exit-stack; python_version=='3.6' # Backends ormar -tortoise-orm=0.17.8 +tortoise-orm==0.17.8 databases aiosqlite sqlalchemy==1.3.22 From 95c9123c6f000386523ecaea84836254177470b5 Mon Sep 17 00:00:00 2001 From: Adam Watkins Date: Wed, 5 Jan 2022 18:04:41 -0800 Subject: [PATCH 6/6] :pushpin: Pin TortoiseORM to 0.17.8 in tests --- tests/dev.requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/dev.requirements.txt b/tests/dev.requirements.txt index 8fed333..4ecb350 100644 --- a/tests/dev.requirements.txt +++ b/tests/dev.requirements.txt @@ -4,7 +4,7 @@ async-exit-stack; python_version=='3.6' # Backends ormar -tortoise-orm==0.17.8 +tortoise-orm==0.17.8; python_version>='3.7' databases aiosqlite sqlalchemy==1.3.22