当前位置: 首页>>代码示例>>Python>>正文


Python DefaultTestFixture.setUp方法代码示例

本文整理汇总了Python中mpx_test.DefaultTestFixture.setUp方法的典型用法代码示例。如果您正苦于以下问题:Python DefaultTestFixture.setUp方法的具体用法?Python DefaultTestFixture.setUp怎么用?Python DefaultTestFixture.setUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mpx_test.DefaultTestFixture的用法示例。


在下文中一共展示了DefaultTestFixture.setUp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

# 需要导入模块: from mpx_test import DefaultTestFixture [as 别名]
# 或者: from mpx_test.DefaultTestFixture import setUp [as 别名]
 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
开发者ID:mcruse,项目名称:monotone,代码行数:28,代码来源:_test_case_subscription_manager.py

示例2: setUp

# 需要导入模块: from mpx_test import DefaultTestFixture [as 别名]
# 或者: from mpx_test.DefaultTestFixture import setUp [as 别名]
 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
开发者ID:mcruse,项目名称:monotone,代码行数:9,代码来源:_test_case_properties.py

示例3: setUp

# 需要导入模块: from mpx_test import DefaultTestFixture [as 别名]
# 或者: from mpx_test.DefaultTestFixture import setUp [as 别名]
 def setUp(self):
     DefaultTestFixture.setUp(self)
     self.lock = Lock()
     self.pool = ThreadPool(3)
     self.queue = Queue()
     self.simple_action_counter = 0
     return
开发者ID:mcruse,项目名称:monotone,代码行数:9,代码来源:_test_case_thread_pool.py

示例4: setUp

# 需要导入模块: from mpx_test import DefaultTestFixture [as 别名]
# 或者: from mpx_test.DefaultTestFixture import setUp [as 别名]
    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)
开发者ID:mcruse,项目名称:monotone,代码行数:31,代码来源:_test_case_other.py

示例5: setUp

# 需要导入模块: from mpx_test import DefaultTestFixture [as 别名]
# 或者: from mpx_test.DefaultTestFixture import setUp [as 别名]
 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
开发者ID:mcruse,项目名称:monotone,代码行数:28,代码来源:_test_case_ewebconnect.py

示例6: setUp

# 需要导入模块: from mpx_test import DefaultTestFixture [as 别名]
# 或者: from mpx_test.DefaultTestFixture import setUp [as 别名]
 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
开发者ID:mcruse,项目名称:monotone,代码行数:33,代码来源:_test_case_XMLRPC.py

示例7: setUp

# 需要导入模块: from mpx_test import DefaultTestFixture [as 别名]
# 或者: from mpx_test.DefaultTestFixture import setUp [as 别名]
 def setUp(self):
     DefaultTestFixture.setUp(self)
     self.log = log.TrimmingLog('trimming_test')
     # __init__(self, name = None, position = None, sort_order = None):
     self.c2 = log.ColumnConfiguration('c2', 1, 'none')
     self.c3 = log.ColumnConfiguration('c3', 2, 'none')
     self.c4 = log.ColumnConfiguration('c4', 3, 'none')
     self.timestamp = log.ColumnConfiguration('timestamp', 0, 'ascending')
     return
开发者ID:mcruse,项目名称:monotone,代码行数:11,代码来源:_test_case_trimming_log.py

示例8: setUp

# 需要导入模块: from mpx_test import DefaultTestFixture [as 别名]
# 或者: from mpx_test.DefaultTestFixture import setUp [as 别名]
 def setUp(self):
     DefaultTestFixture.setUp(self)
     self.data = []
     for x in range(1,20):
         entry = {}
         entry['timestamp'] = time.time()
         entry['column-A'] = x
         self.data.append(entry)
     return
开发者ID:mcruse,项目名称:monotone,代码行数:11,代码来源:_test_case_xml_formatter.py

示例9: setUp

# 需要导入模块: from mpx_test import DefaultTestFixture [as 别名]
# 或者: from mpx_test.DefaultTestFixture import setUp [as 别名]
 def setUp(self):
     DefaultTestFixture.setUp(self)
     self.user_manager = mpx.lib.factory(
         'mpx.service.user_manager.UserManager'
         )
     self.user_manager.configure({'name':'User Manager','parent':None})
     self.passwd_file = self.new_passwd_file()
     f = open(self.passwd_file,'r')
     return
开发者ID:mcruse,项目名称:monotone,代码行数:11,代码来源:_test_case_user_manager.py

示例10: setUp

# 需要导入模块: from mpx_test import DefaultTestFixture [as 别名]
# 或者: from mpx_test.DefaultTestFixture import setUp [as 别名]
 def setUp(self):
     DefaultTestFixture.setUp(self)
     global _failed
     global _callback_stream
     global _reason
     global _callback_count
     _callback_count = 0
     _failed = None
     _callback_stream = None
     _reason = ''
开发者ID:mcruse,项目名称:monotone,代码行数:12,代码来源:_test_case_stream.py

示例11: setUp

# 需要导入模块: from mpx_test import DefaultTestFixture [as 别名]
# 或者: from mpx_test.DefaultTestFixture import setUp [as 别名]
 def setUp(self):
     DefaultTestFixture.setUp(self)
     self.data = []
     ts = float(15*int(time.time()/15))
     for x in range(1,20):
         entry = {}
         entry['timestamp'] = ts
         entry['column-A'] = x
         self.data.append(entry)
         ts += 15
     return
开发者ID:mcruse,项目名称:monotone,代码行数:13,代码来源:_test_case_metermail_formatter.py

示例12: setUp

# 需要导入模块: from mpx_test import DefaultTestFixture [as 别名]
# 或者: from mpx_test.DefaultTestFixture import setUp [as 别名]
 def setUp(self):
     DefaultTestFixture.setUp(self)
     self.data = _DataHolder()
     self.data.configure(['timestamp','column-A'])
     for x in range(1,20):
         self.data.add_entry([time.time(),x])
     exporters = _ParentHolder(self.data)
     exporter = _ParentHolder(exporters)
     exporter.log = self.data
     self.formatter = CSVFormatter()
     self.formatter.configure({'name':'csvformatter','parent':exporter})
开发者ID:mcruse,项目名称:monotone,代码行数:13,代码来源:_test_case_csv_formatter.py

示例13: setUp

# 需要导入模块: from mpx_test import DefaultTestFixture [as 别名]
# 或者: from mpx_test.DefaultTestFixture import setUp [as 别名]
 def setUp(self):
     pfx = '%s.%s: ' % (self.name, f_name())
     DefaultTestFixture.setUp(self)
     # Delete any existing SRNA secure materials trees from 
     # "target NBM":
     print 'prop.SRNATMP_DATA: %s' % prop.SRNATMP_DATA
     if exists(prop.SRNATMP_DATA):
         shutil.rmtree(prop.SRNATMP_DATA, True) # ignore errors
     if exists(prop.SRNA_UPDATE_TGZ):
         os.remove(prop.SRNA_UPDATE_TGZ, True) # ignore errors
     # Delete any existing SRNA secure materials trees from 
     # "admin NBM-Mgr":
     if exists(SRNA_UPDATE_TGZ_SRC_PATH):
         os.remove(SRNA_UPDATE_TGZ_SRC_PATH)
     if exists(IP_ADDRS_PATH):
         os.remove(IP_ADDRS_PATH)
     # Verify that the update_srna_network.pyc tool file is in proper place:
     if not exists(UPDATE_SRNA_NETWORK_PATH):
         self.fail('%sExpected file "%s" to exist; deeply disappointed.' \
                   % (pfx,UPDATE_SRNA_NETWORK_PATH))
         return
     # Verify that the srna_openssl.cnf file is in proper place:
     if not exists(SRNA_OPENSSL_CNF_PATH):
         self.fail('%sExpected file "%s" to exist; deeply disappointed.' \
                   % (pfx, SRNA_OPENSSL_CNF_PATH))
         return
     # Verify that the update_srna_local.pyc tool file is in proper place:
     if not exists(UPDATE_SRNA_LOCAL_PATH):
         self.fail('%sExpected file "%s" to exist; deeply disappointed.' \
                   % (pfx, UPDATE_SRNA_LOCAL_PATH))
         return
     # Verify that ADMINUSER user and home directory for simulated target NBM
     # ALREADY exist (presumably running on an NBM-Mgr...):
     test_ADMINUSER_exist = Popen(('id', ADMINUSER), stdout=PIPE,stderr=PIPE)
     result = test_ADMINUSER_exist.communicate()
     if test_ADMINUSER_exist.returncode != 0:
         self.fail('%sExpected user "%s" to exist; deeply disappointed: %s' \
                   % (pfx, ADMINUSER, result[1]))
         return
     if not os.path.exists(ADMIN_HOME):
         self.fail('%sExpected dir "%s" to exist; deeply disappointed.' \
                   % (pfx, ADMIN_HOME))
         return
     # Create a test IP address list file:
     addr_list_file = open(ADDR_LIST_PATH, 'w')
     addr_list_file.write('127.0.0.1\n127.0.0.1\n')
     addr_list_file.close()
     print 'prop.SRNA_UPDATE_TGZ: %s' % prop.SRNA_UPDATE_TGZ
     return
开发者ID:mcruse,项目名称:monotone,代码行数:51,代码来源:_test_case_tools_srna.py

示例14: setUp

# 需要导入模块: from mpx_test import DefaultTestFixture [as 别名]
# 或者: from mpx_test.DefaultTestFixture import setUp [as 别名]
 def setUp(self):
     DefaultTestFixture.setUp(self)
     self.eth0 = eth.factory()
     self.eth0.configure({'name':'eth0', 'parent':None, 'dev':'eth0'})
     self.ip = ip.factory()
     self.ip.configure({'name':'ip', 'parent':self.eth0})
     self.lhs = tcp_ip_server.TcpIpServer()
     self.lhs.configure({'name':'tcpserver', 'parent':self.ip,
                         'port':8502, 'debug':0})
     self.server = server.ServerDevice()
     self.server.configure({'name':'server', 'parent':self.lhs,
                            'address':255, 'debug':0})
     self.lhc = tcp_ip_line_handler.TcpIpClient()
     self.lhc.configure({'name':'tcpclient', 'parent':self.ip,
                         'ip':self.ip.address, 'port':8502, 'debug':0})
     self.client = generic.Device()
     self.client.configure({'name':'client', 'parent':self.lhc,
                            'address':255, 'debug':0})
     return
开发者ID:mcruse,项目名称:monotone,代码行数:21,代码来源:_test_case_client.py

示例15: setUp

# 需要导入模块: from mpx_test import DefaultTestFixture [as 别名]
# 或者: from mpx_test.DefaultTestFixture import setUp [as 别名]
 def setUp(self):
     DefaultTestFixture.setUp(self)
     try:
         self.root = as_internal_node('/')
         self.services = CompositeNode()
         self.services.configure({'parent':self.root, 'name':'services'})
         self.rna_service = RNA_Tcp()
         # port = 0 indicates that the RNA Service should bind to any
         # available port.
         self.rna_service.configure({'parent':self.services, 'name':'rna',
                                     'port':0, 'enabled':1, 'debug':0})
         self.rna_target = RNATargetNode()
         self.rna_target.configure({'parent':self.services,
                                    'name':'RNA Target'})
         self.aliases = Aliases()
         self.aliases.configure({'parent':self.root, 'name':'aliases'})
         self.root.start()
         # Determine what port the running RNA Service bound to.
         port = self.rna_service.bound_port()
         port_wait_expire_at = time.time() + 1.0
         while not port:
             self.failIf(time.time() > port_wait_expire_at,
                         "Failed to establish test's RNA port.")
             time.sleep(0.1)
             port = self.rna_service.bound_port()
         # Construct the URL explicitly using the port the RNA Service
         # bound to.
         self.rna_target_url = (
             'mpx://localhost:%d/services/RNA%%20Target' % port
             )
         self.alias1 = Alias()
         self.alias1.configure(
             {'parent':self.aliases, 'name':'Remote Target',
              'node_url':self.rna_target_url}
             )
     except:
         self.tearDown()
         raise
     return
开发者ID:mcruse,项目名称:monotone,代码行数:41,代码来源:_test_case_rna.py


注:本文中的mpx_test.DefaultTestFixture.setUp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。