📝 Add source examples for Python 3.9 and 3.10 (#715)
* 📝 Add source examples for Python 3.9 and 3.10 * ✅ Add tests for new source examples for Python 3.9 and 3.10, still needs pytest markers * ✅ Add tests for fastapi examples * ✅ Update tests for FastAPI app testing, for Python 3.9 and 3.10, fixing multi-app testing conflicts * ✅ Require Python 3.9 and 3.10 for tests * ✅ Update tests with missing markers
This commit is contained in:
committed by
GitHub
parent
cce30d7546
commit
d8effcbc5c
@@ -0,0 +1,19 @@
|
||||
from pathlib import Path
|
||||
|
||||
from ...conftest import coverage_run, needs_py310
|
||||
|
||||
|
||||
@needs_py310
|
||||
def test_create_db_and_table(cov_tmp_path: Path):
|
||||
module = "docs_src.tutorial.create_db_and_table.tutorial001_py310"
|
||||
result = coverage_run(module=module, cwd=cov_tmp_path)
|
||||
assert "BEGIN" in result.stdout
|
||||
assert 'PRAGMA main.table_info("hero")' in result.stdout
|
||||
assert "CREATE TABLE hero (" in result.stdout
|
||||
assert "id INTEGER NOT NULL," in result.stdout
|
||||
assert "name VARCHAR NOT NULL," in result.stdout
|
||||
assert "secret_name VARCHAR NOT NULL," in result.stdout
|
||||
assert "age INTEGER," in result.stdout
|
||||
assert "PRIMARY KEY (id)" in result.stdout
|
||||
assert ")" in result.stdout
|
||||
assert "COMMIT" in result.stdout
|
||||
@@ -0,0 +1,16 @@
|
||||
from sqlalchemy import inspect
|
||||
from sqlalchemy.engine.reflection import Inspector
|
||||
from sqlmodel import create_engine
|
||||
|
||||
from ...conftest import needs_py310
|
||||
|
||||
|
||||
@needs_py310
|
||||
def test_create_db_and_table(clear_sqlmodel):
|
||||
from docs_src.tutorial.create_db_and_table import tutorial002_py310 as mod
|
||||
|
||||
mod.sqlite_url = "sqlite://"
|
||||
mod.engine = create_engine(mod.sqlite_url)
|
||||
mod.create_db_and_tables()
|
||||
insp: Inspector = inspect(mod.engine)
|
||||
assert insp.has_table(str(mod.Hero.__tablename__))
|
||||
@@ -0,0 +1,16 @@
|
||||
from sqlalchemy import inspect
|
||||
from sqlalchemy.engine.reflection import Inspector
|
||||
from sqlmodel import create_engine
|
||||
|
||||
from ...conftest import needs_py310
|
||||
|
||||
|
||||
@needs_py310
|
||||
def test_create_db_and_table(clear_sqlmodel):
|
||||
from docs_src.tutorial.create_db_and_table import tutorial003_py310 as mod
|
||||
|
||||
mod.sqlite_url = "sqlite://"
|
||||
mod.engine = create_engine(mod.sqlite_url)
|
||||
mod.create_db_and_tables()
|
||||
insp: Inspector = inspect(mod.engine)
|
||||
assert insp.has_table(str(mod.Hero.__tablename__))
|
||||
Reference in New Issue
Block a user