Fix DeprecationWarning '@pytest.fixture'
This commit is contained in:
parent
00ed537fca
commit
490fcec1a7
8 changed files with 64 additions and 16 deletions
|
@ -9,6 +9,7 @@ from typing import Dict, List, Optional, Set
|
|||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from pydantic import ValidationError
|
||||
|
||||
from aredis_om import (
|
||||
|
@ -30,7 +31,7 @@ if not has_redisearch():
|
|||
today = datetime.date.today()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest_asyncio.fixture
|
||||
async def m(key_prefix, redis):
|
||||
class BaseHashModel(HashModel, abc.ABC):
|
||||
class Meta:
|
||||
|
@ -60,7 +61,7 @@ async def m(key_prefix, redis):
|
|||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest_asyncio.fixture
|
||||
async def members(m):
|
||||
member1 = m.Member(
|
||||
first_name="Andrew",
|
||||
|
@ -357,6 +358,7 @@ def test_validation_passes(m):
|
|||
)
|
||||
assert member.first_name == "Andrew"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_retrieve_first(m):
|
||||
member = m.Member(
|
||||
|
@ -395,6 +397,7 @@ async def test_retrieve_first(m):
|
|||
first_one = await m.Member.find().sort_by("age").first()
|
||||
assert first_one == member3
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_saves_model_and_creates_pk(m):
|
||||
member = m.Member(
|
||||
|
@ -411,6 +414,7 @@ async def test_saves_model_and_creates_pk(m):
|
|||
member2 = await m.Member.get(member.pk)
|
||||
assert member2 == member
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_all_pks(m):
|
||||
member = m.Member(
|
||||
|
@ -441,6 +445,7 @@ async def test_all_pks(m):
|
|||
|
||||
assert len(pk_list) == 2
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_delete(m):
|
||||
member = m.Member(
|
||||
|
|
|
@ -9,6 +9,7 @@ from typing import Dict, List, Optional, Set
|
|||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from pydantic import ValidationError
|
||||
|
||||
from aredis_om import (
|
||||
|
@ -32,7 +33,7 @@ if not has_redis_json():
|
|||
today = datetime.date.today()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest_asyncio.fixture
|
||||
async def m(key_prefix, redis):
|
||||
class BaseJsonModel(JsonModel, abc.ABC):
|
||||
class Meta:
|
||||
|
@ -94,7 +95,7 @@ def address(m):
|
|||
)
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
@pytest_asyncio.fixture()
|
||||
async def members(address, m):
|
||||
member1 = m.Member(
|
||||
first_name="Andrew",
|
||||
|
@ -186,6 +187,7 @@ async def test_saves_model_and_creates_pk(address, m, redis):
|
|||
assert member2 == member
|
||||
assert member2.address == address
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_all_pks(address, m, redis):
|
||||
member = m.Member(
|
||||
|
@ -197,7 +199,7 @@ async def test_all_pks(address, m, redis):
|
|||
address=address,
|
||||
)
|
||||
|
||||
await member.save()
|
||||
await member.save()
|
||||
|
||||
member1 = m.Member(
|
||||
first_name="Simon",
|
||||
|
@ -216,6 +218,7 @@ async def test_all_pks(address, m, redis):
|
|||
|
||||
assert len(pk_list) == 2
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_delete(address, m, redis):
|
||||
member = m.Member(
|
||||
|
|
|
@ -5,6 +5,7 @@ from collections import namedtuple
|
|||
from typing import Optional
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from pydantic import ValidationError
|
||||
|
||||
from aredis_om import HashModel, Migrator, NotFoundError, RedisModelError
|
||||
|
@ -13,7 +14,7 @@ from aredis_om import HashModel, Migrator, NotFoundError, RedisModelError
|
|||
today = datetime.date.today()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest_asyncio.fixture
|
||||
async def m(key_prefix, redis):
|
||||
class BaseHashModel(HashModel, abc.ABC):
|
||||
class Meta:
|
||||
|
@ -42,7 +43,7 @@ async def m(key_prefix, redis):
|
|||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest_asyncio.fixture
|
||||
async def members(m):
|
||||
member1 = m.Member(
|
||||
first_name="Andrew",
|
||||
|
|
|
@ -3,6 +3,7 @@ import datetime
|
|||
from collections import namedtuple
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from pydantic import EmailStr, ValidationError
|
||||
|
||||
from aredis_om import Field, HashModel, Migrator
|
||||
|
@ -11,7 +12,7 @@ from aredis_om import Field, HashModel, Migrator
|
|||
today = datetime.date.today()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest_asyncio.fixture
|
||||
async def m(key_prefix, redis):
|
||||
class BaseHashModel(HashModel, abc.ABC):
|
||||
class Meta:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue