-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run pre-commit hooks for the first time
- Loading branch information
Showing
10 changed files
with
107 additions
and
113 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
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,21 +1,25 @@ | ||
"""Pytest configuration for running the doctests in README.md.""" | ||
|
||
from unittest.mock import Mock | ||
import sqlalchemy as sa | ||
|
||
import pytest | ||
import sqlalchemy as sa | ||
|
||
|
||
@pytest.fixture | ||
def engine(postgresql): | ||
"""Create an SQLAlchemy engine with a disposable PostgreSQL database.""" | ||
return sa.create_engine('postgresql+psycopg://', | ||
poolclass=sa.pool.StaticPool, | ||
pool_reset_on_return=None, | ||
creator=lambda: postgresql) | ||
return sa.create_engine( | ||
"postgresql+psycopg://", | ||
poolclass=sa.pool.StaticPool, | ||
pool_reset_on_return=None, | ||
creator=lambda: postgresql, | ||
) | ||
|
||
|
||
@pytest.fixture(autouse=True) | ||
def add_mock_create_engine(monkeypatch, request): | ||
"""Monkey patch sqlalchemy.create_engine for doctests in README.md.""" | ||
if request.node.name == 'README.md': | ||
engine = request.getfixturevalue('engine') | ||
monkeypatch.setattr(sa, 'create_engine', Mock(return_value=engine)) | ||
if request.node.name == "README.md": | ||
engine = request.getfixturevalue("engine") | ||
monkeypatch.setattr(sa, "create_engine", Mock(return_value=engine)) |
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,4 +1,4 @@ | ||
from .types import Point, Tile | ||
from . import func # noqa: F401 | ||
from .types import Point, Tile | ||
|
||
__all__ = ('Point', 'Tile') | ||
__all__ = ("Point", "Tile") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
"""SQLAlchemy functions.""" | ||
|
||
from sqlalchemy import func as _func | ||
|
||
from .types import Tile as _Tile | ||
|
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
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
Oops, something went wrong.