forked from sopherapps/pydantic-redis
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: redis-separator #192 #277 This adds the ability to customize the redis separator and changes the default separator from _%&_ to :. Additionally, it adds a way for a user to add a prefix to the key space we use, to further differentiate their keys. Finally, it fixes a bug with testing where redislite would not shutdown properly and updates the fixtures to work with the newest version of pytest_asyncio. BREAKING CHANGE: This will result in "data loss" for existing models stored in redis due to the change in default separator. To maintain backwards compatbility with 0.7.0 and below, you will need to modify your existing models to set _redis_separator = "_%&_" as a field on them. * ci: update tests to test new features * ci: update noxfile and requirements for testing * fix: fix for py3.7 and 3.8 * fix: main branch poetry.lock and constraints * fix: fix import order
- Loading branch information
1 parent
b434c0c
commit f367d30
Showing
10 changed files
with
184 additions
and
86 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,8 @@ | ||
|
||
pip==22.2.2 | ||
nox==2022.8.7 | ||
nox-poetry==1.0.1 | ||
poetry==1.2.1 | ||
virtualenv==20.16.5 | ||
poetry-dynamic-versioning==0.19.0 | ||
toml==0.10.2 |
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
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,13 +1,17 @@ | ||
import pytest | ||
import pytest_asyncio | ||
import redislite | ||
from pydantic_aioredis.config import RedisConfig | ||
from pydantic_aioredis.model import Model | ||
from pydantic_aioredis.store import Store | ||
|
||
|
||
@pytest.fixture() | ||
@pytest_asyncio.fixture() | ||
def redis_server(unused_tcp_port): | ||
"""Sets up a fake redis server we can use for tests""" | ||
instance = redislite.Redis(serverconfig={"port": unused_tcp_port}) | ||
yield unused_tcp_port | ||
instance.close() | ||
try: | ||
instance = redislite.Redis(serverconfig={"port": unused_tcp_port}) | ||
yield unused_tcp_port | ||
finally: | ||
instance.close() | ||
instance.shutdown() |
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.