本文整理汇总了Python中mpx_test.DefaultTestFixture类的典型用法代码示例。如果您正苦于以下问题:Python DefaultTestFixture类的具体用法?Python DefaultTestFixture怎么用?Python DefaultTestFixture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DefaultTestFixture类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
DefaultTestFixture.setUp(self)
server_socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
server_socket.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
server_socket.bind(('localhost',0)) # Bind to any available port on
# localhost.
server_socket.listen(5)
sockname = server_socket.getsockname()
##
# Socket ready to accept "eWebConnect" Alarm messages.
self.server_socket = server_socket
##
# The "eWebConnect" host.
self.sever_address = sockname[0]
##
# The "eWebConnect" post.
self.server_port = sockname[1]
self.new_node_tree()
root = as_internal_node('/')
self.configure({'name':'Test Case', 'parent':'/'})
client = EWebConnectAlarmClient()
client.configure({'name':'eWebConnect', 'parent':self,
'host':'localhost',
'port':self.server_port})
as_internal_node('/').start()
return
示例2: setUp
def setUp(self):
mpx.service.session.SessionManager.PASSWD_FILE = (
os.path.join(os.path.dirname(__file__), 'passwd.test')
)
DefaultTestFixture.setUp(self)
self.config = {}
lo = []
lr = {}
lr['alias'] = 'default'
lr['class'] = 'mpx.lib.xmlrpc.XMLRPC_DefaultObject'
lr['lifetime'] = 'Request'
lo.append(lr)
lr = {}
lr['alias'] = 'rna_xmlrpc'
lr['class'] = 'mpx.lib.xmlrpc.rna_xmlrpc.RNA_XMLRPC_Handler'
lr['lifetime'] = 'Runtime'
lo.append(lr)
config = {}
config['name'] = 'XMLRPC_Handler'
config['parent'] = None
config['module'] = ''
config['deployed_objects'] = lo
self.handler = XMLRPC_Handler()
self.handler.configure(config)
root = as_internal_node('/')
self.new_node_tree()
as_internal_node('/').start()
self._session = as_internal_node(
'/services/session_manager'
).create('mpxadmin', 'mpxadmin')
return
示例3: tearDown
def tearDown(self):
try:
self.root.prune()
self.root = None
finally:
DefaultTestFixture.tearDown(self)
return
示例4: setUp
def setUp(self):
DefaultTestFixture.setUp(self)
self.lock = Lock()
self.pool = ThreadPool(3)
self.queue = Queue()
self.simple_action_counter = 0
return
示例5: tearDown
def tearDown(self):
try:
self._circular.close()
del(self._circular)
finally:
DefaultTestFixture.tearDown(self)
return
示例6: setUp
def setUp(self):
global debug
DefaultTestFixture.setUp(self)
self.case = 100
# Set up defaults
self.port = 80
self._username = 'mpxadmin'
self._password = 'mpxadmin'
self.hostname = 'bubba'
self.nodeurl = '/interfaces/eth1/mehtatech_ied_protocol'
# Override as needed
#self.hostname = 'localhost'
#self.port = 8080
self.port = 443
self.xmlrpcurl = 'https://%s:%s/xmlrpc' % (self.hostname, self.port)
self.server = xmlrpclib.Server(self.xmlrpcurl, None, None, debug)
# Authenticate with the server and get back a session ID
self.session = self.server.rna_xmlrpc2.create_session(self._username,
self._password)
示例7: __init__
def __init__(self, other):
DefaultTestFixture.__init__(self, other)
self.eth0 = None
self.ip = None
self.server = None
self.client = None
return
示例8: tearDown
def tearDown(self):
try:
if hasattr(self, 'seq'):
del self.seq
finally:
DefaultTestFixture.tearDown(self)
return
示例9: __init__
def __init__(self, *args, **kw):
DefaultTestFixture.__init__(self, *args,**kw)
EventConsumerMixin.__init__(self, self.change_of_value)
self.__event_lock = Lock()
self.__event_updated_values = {}
self._cov_counter = 0
return
示例10: setUp
def setUp(self):
DefaultTestFixture.setUp(self)
f = StringIO() # A file-like object.
f.write(file_text)
f.seek(0) # Rewind the file.
self.file_object = f
return
示例11: setUp
def setUp(self):
DefaultTestFixture.setUp(self)
self.__event_updated_values = {}
self.new_node_tree()
root = as_internal_node('/')
self._cov_counter = 0
GetException().configure({'name':'exception', 'parent':'/services'})
SUBSCRIPTION_MANAGER.configure({'debug':0,
'_normal_pool_size':2,
'_slow_pool_size':2,
'_prime_pool_size':2,
'_minimum_poll_interval':0.001,
'_slow_poll_threshold':0.500,
}
)
for i in range(0,10):
f = FastNode()
f.configure({'parent':root, 'name':"FastNode-%03d"%i})
s = SlowNode()
s.configure({'parent':root, 'name':"SlowNode-%03d"%i})
e = ErrorNode()
e.configure({'parent':root, 'name':"ErrorNode-%03d"%i})
b = BatchNode(i & 1)
b.configure({'parent':root, 'name':"BatchNode-%03d"%i})
root.start()
return
示例12: tearDown
def tearDown(self):
try:
if hasattr(self,'collector'):
del self.collector
finally:
DefaultTestFixture.tearDown(self)
return
示例13: tearDown
def tearDown(self):
try:
if hasattr(self,'server'):
del self.server
if hasattr(self,'client'):
del self.client
if hasattr(self,'lhc'):
del self.lhc
if hasattr(self,'lhs'):
self.lhs.server.server_thread.should_die()
self.lhs.server.close_connection()
kill_a_server(self.lhs.server.server_thread)
while self.lhs.server.server_thread.isAlive():
time.sleep(0.01)
# @fixme WHY IS THIS COMMENTED?
#self.lhs.server.server_thread.exit()
del self.lhs.server.server_thread
del self.lhs.server
del self.lhs
if hasattr(self,'ip'):
del self.ip
if hasattr(self,'eth0'):
del self.eth0
finally:
DefaultTestFixture.tearDown(self)
return
示例14: tearDown
def tearDown(self):
self.user_manager.stop()
self.user_manager = None
os.unlink(self.passwd_file)
self.passwd_file = None
DefaultTestFixture.tearDown(self)
return
示例15: tearDown
def tearDown(self):
try:
self.rna_target._abort = True
self.root.prune()
self.root = None
finally:
DefaultTestFixture.tearDown(self)
return