本文整理汇总了Python中django.test.LiveServerTestCase.setUpClass方法的典型用法代码示例。如果您正苦于以下问题:Python LiveServerTestCase.setUpClass方法的具体用法?Python LiveServerTestCase.setUpClass怎么用?Python LiveServerTestCase.setUpClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.test.LiveServerTestCase
的用法示例。
在下文中一共展示了LiveServerTestCase.setUpClass方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUpClass
# 需要导入模块: from django.test import LiveServerTestCase [as 别名]
# 或者: from django.test.LiveServerTestCase import setUpClass [as 别名]
def setUpClass(cls):
for arg in sys.argv:
if 'liveserver' in arg:
cls.server_url = 'http://' + arg.split('=')[1]
return
LiveServerTestCase.setUpClass()
cls.server_url = cls.live_server_url
示例2: setUpClass
# 需要导入模块: from django.test import LiveServerTestCase [as 别名]
# 或者: from django.test.LiveServerTestCase import setUpClass [as 别名]
def setUpClass(cls):
for arg in sys.argv:
if 'liveserver' in arg:
cls.server_url = 'http://' + arg.split('=')[1]
fixtures = [] #no fixtures for testing liveserver staging
return
LiveServerTestCase.setUpClass()
cls.server_url = cls.live_server_url
示例3: setUpClass
# 需要导入模块: from django.test import LiveServerTestCase [as 别名]
# 或者: from django.test.LiveServerTestCase import setUpClass [as 别名]
def setUpClass(cls):
for arg in sys.argv:
if 'liveserver' in arg:
cls.server_url = "http://" + arg.split("=")[1]
return
LiveServerTestCase.setUpClass()
#cls.server_url = cls.live_server_url
cls.server_url = "http://127.0.0.1:8081/"
示例4: setUpClass
# 需要导入模块: from django.test import LiveServerTestCase [as 别名]
# 或者: from django.test.LiveServerTestCase import setUpClass [as 别名]
def setUpClass(cls):
for arg in sys.argv:
if "liveserver" in arg:
cls.server_host = arg.split("=")[1]
cls.server_url = "http://" + cls.server_host
cls.against_staging = True
return
LiveServerTestCase.setUpClass()
cls.against_staging = False
cls.server_url = cls.live_server_url
示例5: setUpClass
# 需要导入模块: from django.test import LiveServerTestCase [as 别名]
# 或者: from django.test.LiveServerTestCase import setUpClass [as 别名]
def setUpClass(cls):
"""
this methos allow run test using:
manage.py test functional_tests --liveserver=my-staging-server.com
"""
for arg in sys.argv:
if 'liveserver' in arg:
cls.server_url = 'http://' + arg.split('=')[1]
return
LiveServerTestCase.setUpClass()
cls.server_url = cls.live_server_url
示例6: setUpClass
# 需要导入模块: from django.test import LiveServerTestCase [as 别名]
# 或者: from django.test.LiveServerTestCase import setUpClass [as 别名]
def setUpClass(cls):
cls.display = None
try:
display = Display(visible=0, size=(1024, 768))
display.start()
except:
pass
for arg in sys.argv:
if 'liveserver' in arg:
cls.server_url = 'http://' + arg.split('=')[1]
return
cls.browser = webdriver.Firefox()
cls.browser.implicitly_wait(5)
LiveServerTestCase.setUpClass()
cls.server_url = cls.live_server_url
示例7: start_liveserver_if_needed
# 需要导入模块: from django.test import LiveServerTestCase [as 别名]
# 或者: from django.test.LiveServerTestCase import setUpClass [as 别名]
def start_liveserver_if_needed(cls):
cls.liveserver_url = None
for api_cls in cls.get_test_api_classes():
if not getattr(api_cls, 'needs_live_server', False):
continue
if cls.liveserver_url is None:
LiveServerTestCase.setUpClass()
cls.selenium = WebDriver()
# inlined from LiveServerTestCase
cls.liveserver_url = 'http://%s:%s' % (
LiveServerTestCase.server_thread.host, LiveServerTestCase.server_thread.port)
api_cls.server_thread = LiveServerTestCase.server_thread
api_cls.selenium = cls.selenium
api_cls.liveserver_url = cls.liveserver_url
cls.has_liveserver = cls.liveserver_url is not None