Skip to content
Go to file
Cannot retrieve contributors at this time
27 lines (20 sloc) 751 Bytes
from example.models import Dog
import pytest
# If your tests need to use the database and want to use pytest
# function test approach, you need to `mark` it.
def test_save():
maven = Dog(name="Maven", breed="corgi")
assert == "Maven"
assert maven.breed == "corgi"
# Any existing `unittest` style tests still work without any changes needed.
from django.test import TestCase
class ExampleTestCase(TestCase):
def setUp(self):
self.maven = Dog(name="Maven", breed="corgi")
def test_save(self):
self.assertEquals(, "Maven")
# You can mix in pytest's `assert` approach!
assert self.maven.breed == "corgi"
You can’t perform that action at this time.