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


Python TestCase.setUp方法代码示例

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


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

示例1: setUp

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import setUp [as 别名]
 def setUp(self):
     TestCase.setUp(self)
     self.root = "/tmp/lstestdir/"
     self.link_file_src = "/tmp/mylink.txt"
     self.date_string = self.todays_date()
     self.remove_folder_structure()
     self.create_folder_structure()
开发者ID:muccg,项目名称:yabi,代码行数:9,代码来源:ls_tests.py

示例2: setUp

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import setUp [as 别名]
    def setUp(self):
        TestCase.setUp(self)

        self._expandCalled = 0
        self._collapseCalled = 0
        self._lastExpanded = 0
        self._lastCollapsed = 0
开发者ID:MatiasNAmendola,项目名称:muntjac,代码行数:9,代码来源:test_tree_listeners.py

示例3: setUp

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import setUp [as 别名]
    def setUp(self):
        TestCase.setUp(self)
#        file = open("./hello.py", "a+")
#        file.write("\"\"\"this is a hello module\"\"\"")
#        file.close()
        from com.gmail.takashi316.lib.file import hello
        self.applicationDirectory = ApplicationDirectory(hello)
开发者ID:TakashiSasaki,项目名称:python-lib,代码行数:9,代码来源:ApplicationDirectory.py

示例4: setUp

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import setUp [as 别名]
 def setUp(self):
   TestCase.setUp(self)
   gc.set_threshold(500, 10, 10)
   self._started = False
   self._ioloop = rpclib.ioloop()
   rpclib.__IOLOOP__ = self._ioloop
   self._exc_info = None
开发者ID:thenaran,项目名称:clique,代码行数:9,代码来源:testing.py

示例5: setUp

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import setUp [as 别名]
 def setUp(self):
     TestCase.setUp(self)
     from google.appengine.ext.testbed import Testbed
     self.testbed = Testbed()
     self.testbed.activate()
     self.testbed.init_datastore_v3_stub()
     self.testbed.init_memcache_stub()
开发者ID:TakashiSasaki,项目名称:odenkiapi-backup,代码行数:9,代码来源:RawDataNdb.py

示例6: setUp

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import setUp [as 别名]
 def setUp(self):
     TestCase.setUp(self)
     self.tempdir = mkdtemp()
     fd, self.tempfile = mkstemp()
     os.close(fd)
     self.reactor = Reactor()
     self.port = PortNumberGenerator.next()
开发者ID:seecr,项目名称:weightless-core,代码行数:9,代码来源:weightlesstestcase.py

示例7: setUp

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import setUp [as 别名]
    def setUp(self):
        TestCase.setUp(self)
        datadir = "../../data"
        dist = ('Ubuntu', '12.10', 'quantal')

        sys.path.insert(0, "..")

        self._tApp = KazamApp(datadir, dist, False, False, False, False)
开发者ID:aaae,项目名称:kazam,代码行数:10,代码来源:test_app.py

示例8: setUp

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import setUp [as 别名]
 def setUp(self):
     TestCase.setUp(self)
     api._MANAGER = None
     api._create_manager()
     api._MANAGER.importers.add_plugin(IMPORTER_ID, MockImporter, {})
     api._MANAGER.group_importers.add_plugin(GRP_IMPORTER_ID, MockGroupImporter, {})
     api._MANAGER.distributors.add_plugin(DISTRIBUTOR_ID, MockDistributor, {})
     api._MANAGER.group_distributors.add_plugin(GRP_DISTRIBUTOR_ID, MockGroupDistributor, {})
     api._MANAGER.profilers.add_plugin(PROFILER_ID, MockProfiler, {}, TYPES)
     api._MANAGER.catalogers.add_plugin(CATALOGER_ID, MockCataloger, {})
开发者ID:AndreaGiardini,项目名称:pulp,代码行数:12,代码来源:test_plugin_api.py

示例9: setUp

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import setUp [as 别名]
 def setUp(self):
   TestCase.setUp(self)
   self._sample1 = os.path.join(
       os.path.dirname(os.path.abspath(__file__)), 'sample1')
   with open(self._sample1, 'w') as wf:
     wf.write(JSON_SAMPLE1)
   self._sample2 = os.path.join(
       os.path.dirname(os.path.abspath(__file__)), 'sample2')
   with open(self._sample2, 'w') as wf:
     wf.write(JSON_SAMPLE2)
   self._sample3 = os.path.join(
       os.path.dirname(os.path.abspath(__file__)), 'sample3')
开发者ID:thenaran,项目名称:clique,代码行数:14,代码来源:config_test.py

示例10: setup_class

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import setUp [as 别名]
 def setup_class(self):
     """ real setup """
     TestCase.setUp(self)
     config_parser = ConfigReader('/home/pi/server/config/raspicam.cfg')
     cfg = config_parser.parser()
     # test in local(Rpi)
     recmng = RecordMng(cfg.record)
     vvpmng = VideoProcessMng(cfg.video)
     self.testthr = threading.Thread(target=httpserve, \
                                     args=(cfg, recmng, vvpmng))
     self.testthr.setDaemon(True)
     self.testthr.start()
开发者ID:everhopingandwaiting,项目名称:RaspiCam,代码行数:14,代码来源:test_httpserver.py

示例11: setUp

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import setUp [as 别名]
    def setUp(self):
        UnitTestCase.setUp(self)
        setup_test_environment()

        if 'utrunner' not in sys.argv[0]:
            self.skipTest('Only can run with unittest.')

        self.client = Client()
        self.client.login(username='jack', password='qwer1234')

        print '.' * 100
        print "<%s> currently run: %s" % (self.__class__.__name__, self._testMethodName)
        print '.' * 100 + '\n'
开发者ID:jack2150,项目名称:rivers,代码行数:15,代码来源:utests.py

示例12: setUp

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import setUp [as 别名]
 def setUp(self):
     TestCase.setUp(self)
     try:
         import webtest
     except ImportError:
         import setuptools.command.easy_install as easy_install
         easy_install.main(["WebTest"])
         exit()
     self.test_app = webtest.TestApp(_wsgi_application)
     from google.appengine.ext.testbed import Testbed
     self.testbed = Testbed()
     self.testbed.activate()
     self.testbed.init_datastore_v3_stub()
     self.testbed.init_memcache_stub()
开发者ID:TakashiSasaki,项目名称:odenkiapi-backup,代码行数:16,代码来源:post.py

示例13: setUp

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import setUp [as 别名]
	def setUp(self):
		TestCase.setUp(self)
		self.fig = FiguraGeometrica()

		#Retorna um NotImplementedError.
		#O nome do método deve começar com test!
		def test_get_area(self):
			self.assertRaises(NotImplementedError, self.fig.get_area)

		def test_get_perimetro(self):
			self.assertRaises(NotImplementedError, self.fig.get_perimetro)

		#Terei a verificação da execução dos métodos da classe FiguraGeometrica
		#Como será uma classe abstrata, esses métodos serão vazios
		#ou seja, os métodos devem ser implementados nas classes filhas dessa classe!
开发者ID:FelipeMariano,项目名称:python_test_tutorial,代码行数:17,代码来源:figura_geometrica_test.py

示例14: setUp

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import setUp [as 别名]
    def setUp(self):
        TestCase.setUp(self)

        self.oldcwd = os.getcwd()

        self.repo_parent = mkdtemp(prefix='test_git_')
        self.prepare_repository(self.repo_parent, "meta-project-0.1")

        self.repo_one = mkdtemp(prefix='test_git_')
        self.prepare_repository(self.repo_one, "project-1.0.59", number_of_commits_since=1)

        self.repo_two = mkdtemp(prefix='test_git_')
        self.prepare_repository(self.repo_two, "secondproject-2.0", file_name="second.txt", number_of_commits_since=12)

        os.chdir(self.repo_parent)
开发者ID:joelimome,项目名称:citools,代码行数:17,代码来源:test_versioning.py

示例15: setUp

# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import setUp [as 别名]
    def setUp(self):
        """Set up environment for tests.

        When redefining this method in child classes, make sure to call it
        before child's setup has started.
        """
        TestCase.setUp(self)
        logger = getLogger()
        # Save existing data about logging system (log level and handlers)
        self.__backup_loglevel = logger.getEffectiveLevel()
        logger.setLevel(DEBUG)
        self.__backup_log_handlers = []
        for handler in logger.handlers:
            self.__backup_log_handlers.append(handler)
            logger.removeHandler(handler)
        # Place test logger instead of them
        self.__test_log_handler = TestLogHandler()
        logger.addHandler(self.__test_log_handler)
开发者ID:DarkFenX,项目名称:eos,代码行数:20,代码来源:testcase.py


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