fix coverage
This commit is contained in:
6
Makefile
6
Makefile
@ -17,3 +17,9 @@ test_mysql:
|
|||||||
|
|
||||||
test_sqlite:
|
test_sqlite:
|
||||||
bash scripts/test.sh -svv
|
bash scripts/test.sh -svv
|
||||||
|
|
||||||
|
test:
|
||||||
|
pytest
|
||||||
|
|
||||||
|
coverage:
|
||||||
|
pytest --cov=ormar --cov=tests --cov-fail-under=100 --cov-report=term-missing
|
||||||
@ -218,6 +218,19 @@ def test_decimal_error_in_model_definition():
|
|||||||
test: decimal.Decimal = ormar.Decimal(primary_key=True)
|
test: decimal.Decimal = ormar.Decimal(primary_key=True)
|
||||||
|
|
||||||
|
|
||||||
|
@typing.no_type_check
|
||||||
|
def test_binary_error_without_length_model_definition():
|
||||||
|
with pytest.raises(ModelDefinitionError):
|
||||||
|
|
||||||
|
class ExampleModel2(Model):
|
||||||
|
class Meta:
|
||||||
|
tablename = "example6"
|
||||||
|
database = database
|
||||||
|
metadata = metadata
|
||||||
|
|
||||||
|
test: bytes = ormar.LargeBinary(primary_key=True)
|
||||||
|
|
||||||
|
|
||||||
@typing.no_type_check
|
@typing.no_type_check
|
||||||
def test_string_error_in_model_definition():
|
def test_string_error_in_model_definition():
|
||||||
with pytest.raises(ModelDefinitionError):
|
with pytest.raises(ModelDefinitionError):
|
||||||
|
|||||||
@ -17,7 +17,7 @@ class BaseMeta(ormar.ModelMeta):
|
|||||||
database = database
|
database = database
|
||||||
|
|
||||||
|
|
||||||
class Test(ormar.Model):
|
class ModelTest(ormar.Model):
|
||||||
class Meta(BaseMeta):
|
class Meta(BaseMeta):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ def create_test_database():
|
|||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_working_with_pydantic_fields():
|
async def test_working_with_pydantic_fields():
|
||||||
async with database:
|
async with database:
|
||||||
test = Test(name="Test")
|
test = ModelTest(name="Test")
|
||||||
assert test.name == "Test"
|
assert test.name == "Test"
|
||||||
assert test.url == "www.example.com"
|
assert test.url == "www.example.com"
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ async def test_working_with_pydantic_fields():
|
|||||||
assert test.url == "www.sdta.ada.pt"
|
assert test.url == "www.sdta.ada.pt"
|
||||||
|
|
||||||
await test.save()
|
await test.save()
|
||||||
test_check = await Test.objects.get()
|
test_check = await ModelTest.objects.get()
|
||||||
|
|
||||||
assert test_check.name == "Test"
|
assert test_check.name == "Test"
|
||||||
assert test_check.url == "www.example.com"
|
assert test_check.url == "www.example.com"
|
||||||
|
|||||||
Reference in New Issue
Block a user