runtests.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:django-learning 作者: adoggie 项目源码 文件源码
def run_tests():
    # Making Django run this way is a two-step process. First, call
    # settings.configure() to give Django settings to work with:
    from django.conf import settings
    settings.configure(**SETTINGS_DICT)

    # Then, call django.setup() to initialize the application cache
    # and other bits:
    import django
    if hasattr(django, 'setup'):
        django.setup()

    # Now we instantiate a test runner...
    from django.test.utils import get_runner
    TestRunner = get_runner(settings)

    # And then we run tests and return the results.
    test_runner = TestRunner(verbosity=1, interactive=True)
    failures = test_runner.run_tests(['registration.tests'])
    sys.exit(bool(failures))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号