Skip to content

Commit 743eecc

Browse files
author
Adam Watkins
committed
⚗️ Add py.typed integration tests
1 parent 497e144 commit 743eecc

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import pathlib
2+
3+
file = pathlib.Path(__file__)
4+
package = file.parent.parent.parent / "fastapi_crudrouter"
5+
6+
7+
def test_py_typed_file_exists():
8+
assert (package / "py.typed").exists()
9+
assert (package / "py.typed").is_file()
10+
11+
12+
def test_virtualenv(virtualenv):
13+
assert (package).exists()
14+
15+
virtualenv.run(f"pip install -e {package}")
16+
virtualenv.run(f"pip install mypy")
17+
virtualenv.run(f"mypy {file}")
18+
19+
20+
if __name__ == "__main__":
21+
from pydantic import BaseModel
22+
from fastapi import FastAPI
23+
24+
import fastapi_crudrouter
25+
26+
class User(BaseModel):
27+
id: int
28+
name: str
29+
email: str
30+
31+
router = fastapi_crudrouter.MemoryCRUDRouter(schema=User)
32+
app = FastAPI()
33+
app.include_router(router)

0 commit comments

Comments
 (0)