FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

✅ Refactor tests to use autouse `clear_sqlmodel` by tiangolo · Pull Request #1406 · fastapi/sqlmodel · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (28) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
4 changes: 2 additions & 2 deletions tests/conftest.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
docs_src_path = top_level_path / "docs_src"


@pytest.fixture()
def clear_sqlmodel():
@pytest.fixture(autouse=True)
def clear_sqlmodel() -> Any:
# Clear the tables in the metadata for the default base model
SQLModel.metadata.clear()
# Clear the Models associated with the registry, to avoid warnings
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
]


def test_tutorial(clear_sqlmodel):
def test_tutorial():
from docs_src.advanced.decimal import tutorial001 as mod

mod.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@


@needs_py310
def test_tutorial(clear_sqlmodel):
def test_tutorial():
from docs_src.advanced.decimal import tutorial001_py310 as mod

mod.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from ...conftest import get_testing_print_function


def test_tutorial(clear_sqlmodel) -> None:
def test_tutorial() -> None:
from docs_src.advanced.uuid import tutorial001 as mod

mod.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


@needs_py310
def test_tutorial(clear_sqlmodel) -> None:
def test_tutorial() -> None:
from docs_src.advanced.uuid import tutorial001_py310 as mod

mod.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from ...conftest import get_testing_print_function


def test_tutorial(clear_sqlmodel) -> None:
def test_tutorial() -> None:
from docs_src.advanced.uuid import tutorial002 as mod

mod.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


@needs_py310
def test_tutorial(clear_sqlmodel) -> None:
def test_tutorial() -> None:
from docs_src.advanced.uuid import tutorial002_py310 as mod

mod.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def check_calls(calls: List[List[Union[str, Dict[str, Any]]]]):
]


def test_tutorial_001(clear_sqlmodel):
def test_tutorial_001():
from docs_src.tutorial.automatic_id_none_refresh import tutorial001 as mod

mod.sqlite_url = "sqlite://"
Expand All @@ -147,7 +147,7 @@ def test_tutorial_001(clear_sqlmodel):
check_calls(calls)


def test_tutorial_002(clear_sqlmodel):
def test_tutorial_002():
from docs_src.tutorial.automatic_id_none_refresh import tutorial002 as mod

mod.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
]


def test_tutorial(clear_sqlmodel):
def test_tutorial():
from docs_src.tutorial.code_structure.tutorial001 import app, database

database.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


@needs_py310
def test_tutorial(clear_sqlmodel):
def test_tutorial():
from docs_src.tutorial.code_structure.tutorial001_py310 import app, database

database.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


@needs_py39
def test_tutorial(clear_sqlmodel):
def test_tutorial():
from docs_src.tutorial.code_structure.tutorial001_py39 import app, database

database.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
]


def test_tutorial(clear_sqlmodel):
def test_tutorial():
from docs_src.tutorial.code_structure.tutorial002 import app, database

database.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


@needs_py310
def test_tutorial(clear_sqlmodel):
def test_tutorial():
from docs_src.tutorial.code_structure.tutorial002_py310 import app, database

database.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


@needs_py39
def test_tutorial(clear_sqlmodel):
def test_tutorial():
from docs_src.tutorial.code_structure.tutorial002_py39 import app, database

database.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from sqlmodel import create_engine


def test_tutorial001(clear_sqlmodel):
def test_tutorial001():
from docs_src.tutorial.connect.create_tables import tutorial001 as mod

mod.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


@needs_py310
def test_tutorial001(clear_sqlmodel):
def test_tutorial001():
from docs_src.tutorial.connect.create_tables import tutorial001_py310 as mod

mod.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
]


def test_tutorial(clear_sqlmodel):
def test_tutorial():
from docs_src.tutorial.connect.delete import tutorial001 as mod

mod.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@


@needs_py310
def test_tutorial(clear_sqlmodel):
def test_tutorial():
from docs_src.tutorial.connect.delete import tutorial001_py310 as mod

mod.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
]


def test_tutorial001(clear_sqlmodel):
def test_tutorial001():
from docs_src.tutorial.connect.insert import tutorial001 as mod

mod.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@


@needs_py310
def test_tutorial001(clear_sqlmodel):
def test_tutorial001():
from docs_src.tutorial.connect.insert import tutorial001_py310 as mod

mod.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@


@needs_py310
def test_tutorial001(clear_sqlmodel):
def test_tutorial001():
from docs_src.tutorial.connect.select import tutorial001_py310 as mod

mod.sqlite_url = "sqlite://"
Expand All @@ -78,7 +78,7 @@ def test_tutorial001(clear_sqlmodel):


@needs_py310
def test_tutorial002(clear_sqlmodel):
def test_tutorial002():
from docs_src.tutorial.connect.select import tutorial002_py310 as mod

mod.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
]


def test_tutorial001(clear_sqlmodel):
def test_tutorial001():
from docs_src.tutorial.connect.select import tutorial001 as mod

mod.sqlite_url = "sqlite://"
Expand All @@ -76,7 +76,7 @@ def test_tutorial001(clear_sqlmodel):
assert calls == expected_calls


def test_tutorial002(clear_sqlmodel):
def test_tutorial002():
from docs_src.tutorial.connect.select import tutorial002 as mod

mod.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
]


def test_tutorial(clear_sqlmodel):
def test_tutorial():
from docs_src.tutorial.connect.select import tutorial003 as mod

mod.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@


@needs_py310
def test_tutorial(clear_sqlmodel):
def test_tutorial():
from docs_src.tutorial.connect.select import tutorial003_py310 as mod

mod.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
]


def test_tutorial(clear_sqlmodel):
def test_tutorial():
from docs_src.tutorial.connect.select import tutorial004 as mod

mod.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@


@needs_py310
def test_tutorial(clear_sqlmodel):
def test_tutorial():
from docs_src.tutorial.connect.select import tutorial004_py310 as mod

mod.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
]


def test_tutorial(clear_sqlmodel):
def test_tutorial():
from docs_src.tutorial.connect.select import tutorial005 as mod

mod.sqlite_url = "sqlite://"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@


@needs_py310
def test_tutorial(clear_sqlmodel):
def test_tutorial():
from docs_src.tutorial.connect.select import tutorial005_py310 as mod

mod.sqlite_url = "sqlite://"
Expand Down

Back | FazBrowse Home | New Git URL