fix coverage

This commit is contained in:
collerek
2021-04-28 17:16:30 +02:00
parent 11ed5fd322
commit d2921167bd
3 changed files with 23 additions and 4 deletions

View File

@ -16,4 +16,10 @@ test_mysql:
docker-compose -f scripts/docker-compose.yml stop mysql
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

View File

@ -218,6 +218,19 @@ def test_decimal_error_in_model_definition():
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
def test_string_error_in_model_definition():
with pytest.raises(ModelDefinitionError):

View File

@ -17,7 +17,7 @@ class BaseMeta(ormar.ModelMeta):
database = database
class Test(ormar.Model):
class ModelTest(ormar.Model):
class Meta(BaseMeta):
pass
@ -44,7 +44,7 @@ def create_test_database():
@pytest.mark.asyncio
async def test_working_with_pydantic_fields():
async with database:
test = Test(name="Test")
test = ModelTest(name="Test")
assert test.name == "Test"
assert test.url == "www.example.com"
@ -52,7 +52,7 @@ async def test_working_with_pydantic_fields():
assert test.url == "www.sdta.ada.pt"
await test.save()
test_check = await Test.objects.get()
test_check = await ModelTest.objects.get()
assert test_check.name == "Test"
assert test_check.url == "www.example.com"