我不明白为什么没有测试是使用:
python tests/quick_tests.py
和python unittest。你知道吗
文件内容如下:
import sys
import os
from App import app
import unittest
from App.helpers import *
from werkzeug.security import generate_password_hash
import requests
import pdb
import pickle
from App.models import *
import re
from httmock import all_requests, response, HTTMock, urlmatch
from mock_apis import *
class AppTestCase(unittest.TestCase):
def setUp(self):
self.app = app.test_client()
app.config['WTF_CSRF_ENABLED'] = False
def tearDown(self):
del self.app
def testhome(self):
with app.app_context():
r = self.app.get('/')
self.assertEqual(r.status_code, 200)
if __name__ == '__main__':
unittest.main()
结果是:
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
请引导我。感谢您的帮助!你知道吗
在我的
App
中遍历这些文件,并以二进制搜索的方式对它们进行注释,查看unittests开始中断的地方,我发现删除一个import ipdb
可以解决问题。我不知道从中可以得出什么结论,除了:Unittest不能很好地处理ipdb。希望这篇文章能在将来节省其他人的时间。你知道吗试试这个:
相关问题 更多 >
编程相关推荐