我正在使用model-mommy生成测试数据,如此
class AuthorDetailViewTests(TestCase):
def setUp(self):
# set bio manually to avoid error being thrown by template tag markdown_format
self.author = mommy.make('author.Author', bio='Some bio text')
def tearDown(self):
self.author.delete()
setUp()
方法运行正常。问题是tearDown()
方法实际上并没有删除创建的author
实例。有没有办法实现这个目标?感谢