-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Ensure base model compatibility with DeclarativeBase subclasses.
- Loading branch information
Showing
6 changed files
with
36 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "pytest-mock-resources" | ||
version = "2.9.1" | ||
version = "2.9.2" | ||
description = "A pytest plugin for easily instantiating reproducible mock resources." | ||
authors = [ | ||
"Omar Khan <[email protected]>", | ||
|
This file contains 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
This file contains 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
This file contains 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
Empty file.
This file contains 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from tests import is_at_least_sqlalchemy2 | ||
|
||
if is_at_least_sqlalchemy2: | ||
from sqlalchemy import Column, Integer | ||
from sqlalchemy.orm import DeclarativeBase | ||
|
||
from pytest_mock_resources import create_postgres_fixture | ||
|
||
class Base(DeclarativeBase): | ||
... | ||
|
||
class Thing(Base): | ||
__tablename__ = "thing" | ||
|
||
id = Column(Integer, autoincrement=True, primary_key=True) | ||
|
||
pg = create_postgres_fixture(Base, session=True) | ||
|
||
def test_creates_ddl(pg): | ||
rows = pg.query(Thing).all() | ||
assert len(rows) == 0 |