本文整理汇总了Python中server.Server.now方法的典型用法代码示例。如果您正苦于以下问题:Python Server.now方法的具体用法?Python Server.now怎么用?Python Server.now使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类server.Server
的用法示例。
在下文中一共展示了Server.now方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_project_withClients
# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import now [as 别名]
def test_project_withClients(self) :
s = Server("fixture")
s.createServer()
s.createProject("myproject")
s.createClient("myproject","myclient")
s.setClientMetadata("myproject", "myclient",
description = "a description",
briefDescription = "brief description",
)
s.createClient("myproject","yourclient")
s.setClientMetadata("myproject", "yourclient",
description = "your description",
briefDescription = "your brief description",
)
# force an idle time
s.now=datetime.datetime(2013,4,5,6,7,8)
s.clientIdle("myproject", "myclient", 0)
s.clientIdle("myproject", "yourclient", 0)
s.now = datetime.datetime(2013,9,1,2,3,4)
w = JsonSummary()
result = w.project(s, 'myproject')
self.assertMultiLineEqual(result,
'{'
' "project" : "myproject",\n'
' "lastupdate" : "2013/09/01 02:03:04",\n'
' "clients" : [\n'
' {\n'
' "name": "myclient",\n'
' "description": \'a description\',\n'
' "name_details": \'brief description\',\n'
' "status": "int",\n'
' "doing": "old",\n'
' "lastupdate": "2013/04/05 06:07:08",\n'
' "lastExecution": "19000101-000000",\n'
' },\n'
' {\n'
' "name": "yourclient",\n'
' "description": \'your description\',\n'
' "name_details": \'your brief description\',\n'
' "status": "int",\n'
' "doing": "old",\n'
' "lastupdate": "2013/04/05 06:07:08",\n'
' "lastExecution": "19000101-000000",\n'
' },\n'
' ]\n'
'}'
)
示例2: setUpEmptyClient
# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import now [as 别名]
def setUpEmptyClient(self) :
s = Server("fixture")
s.createServer()
s.createProject("myproject")
s.now = datetime.datetime(2013,4,5,6,7,8)
s.createClient("myproject", "myclient")
s.setClientMetadata("myproject", "myclient",
description = "a description",
briefDescription = "brief description",
)
# force an idle time
s.clientIdle("myproject", "myclient", 0)
s.now = datetime.datetime(2013,4,5,6,7,1)
return s
示例3: emptyExecution
# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import now [as 别名]
def emptyExecution(self) :
project, client, execution = "myproject", "myclient", "20130301-232425"
s = Server("fixture")
s.createServer()
s.createProject(project)
s.createClient(project, client)
# force an idle time
s.now=datetime.datetime(2013,4,5,6,7,8)
s.clientIdle("myproject", "myclient", 0)
e = ArgPrepender(s, project, client, execution)
e.executionStarts(
timestamp="2013-03-01 23:24:25",
changelog=[])
e.executionEnds(True)
return e.execution()
示例4: test_project_noClients
# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import now [as 别名]
def test_project_noClients(self) :
s = Server("fixture")
s.createServer()
s.createProject("myproject")
s.setProjectMetadata("myproject",
description = "project description",
briefDescription = "project brief description",
)
s.now = datetime.datetime(2013,9,1,2,3,4)
w = JsonSummary()
result = w.project(s, 'myproject')
self.assertMultiLineEqual(result,
'{'
' "project" : "myproject",\n'
' "lastupdate" : "2013/09/01 02:03:04",\n'
' "clients" : [\n'
' ]\n'
'}'
)
示例5: executionFixture
# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import now [as 别名]
def executionFixture(self, running = False) :
project, client, execution = "myproject", "myclient", "20130301-232425"
s = Server("fixture")
s.createServer()
s.createProject(project)
s.createClient(project, client)
# force an idle time
s.now=datetime.datetime(2013,4,5,6,7,8)
s.clientIdle(project,client, 0)
e = ArgPrepender(s, project, client, execution)
e.executionStarts(
timestamp="2013-03-01 23:24:25",
changelog=[])
e.taskStarts(1, "First task")
e.commandStarts(1,1, "command line")
if running : return e.execution()
e.commandEnds(1,1, output="output", ok=True, info=None, stats={})
e.taskEnds(1,True)
e.executionEnds(True)
return e.execution()
示例6: Server
# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import now [as 别名]
s.commandEnds(i+1, j+1,
output=output,
ok=ok,
info=info,
stats=stats)
if ok is False : break # Failed, fatal for the task
s.taskEnds(i+1,ok)
s.executionEnds(ok)
print "Simulating client calls"
import os
s = Server("fixture")
os.system("rm -rf fixture")
os.system("rm -rf www")
s.createServer()
s.now = datetime.datetime(2000,01,02,03,04,05)
s.createProject("myproject")
s.createClient("myproject", "client1")
s.createClient("myproject", "client2")
s.createClient("myproject", "client3")
emulateExecution("client1", "20130304-050607",[
("first task", [
("command 1", True, "output", None, dict(
tests = 34,
)),
]),
])
emulateExecution("client1", "20130304-050608",[
("first task", [
("command 1", True, "output", "Info", dict(