本文整理汇总了Python中unittest.TestCase.tearDown方法的典型用法代码示例。如果您正苦于以下问题:Python TestCase.tearDown方法的具体用法?Python TestCase.tearDown怎么用?Python TestCase.tearDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unittest.TestCase
的用法示例。
在下文中一共展示了TestCase.tearDown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tearDown
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import tearDown [as 别名]
def tearDown(self):
TestCase.tearDown(self)
os.chdir(self.oldcwd)
rmtree(self.repo_parent)
rmtree(self.repo_one)
rmtree(self.repo_two)
示例2: tearDown
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import tearDown [as 别名]
def tearDown(self):
TestCase.tearDown(self)
if os.path.exists(self._sample1):
os.remove(self._sample1)
if os.path.exists(self._sample2):
os.remove(self._sample2)
if os.path.exists(self._sample3):
os.remove(self._sample3)
示例3: tearDown
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import tearDown [as 别名]
def tearDown(self):
if cpython:
def tostr(o):
try:
return tostring(o)
except:
return repr(o)
gc.collect()
for obj in self.get_tracked_objects():
self.assertTrue(obj in self._baseline, obj) #tostr(obj))
del self._baseline
gc.collect()
TestCase.tearDown(self)
示例4: tearDown
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import tearDown [as 别名]
def tearDown(self):
t0 = time()
if hasattr(self, 'httpd') and hasattr(self.httpd, 'shutdown'):
self.httpd.shutdown()
self.assertEquals({}, self.reactor._fds)
self.assertEquals({}, self.reactor._suspended)
self.assertEquals({}, self.reactor._processes)
for t in self.reactor._timers:
cb = t.callback
code = cb.func_code
print 'WARNING: dangling timer in reactor. Remaining timout: %s with callback to %s() in %s at line %s.' \
% (t.time-t0, cb.func_name, code.co_filename, code.co_firstlineno)
self.assertEquals([], self.reactor._timers)
self.reactor.shutdown()
rmtree(self.tempdir)
os.remove(self.tempfile)
TestCase.tearDown(self)
示例5: tearDown
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import tearDown [as 别名]
def tearDown(self):
def tostr(o):
if isframe(o):
return getframeinfo(o)
try:
return tostring(o)
except:
return repr(o)
gc.collect()
diff = set(self.get_tracked_objects()) - set(self._baseline)
self.assertEquals(set(), diff)
for obj in diff:
print "Leak:"
print tostr(obj)
print "Referrers:"
for o in gc.get_referrers(obj):
print tostr(o)
del self._baseline
gc.collect()
TestCase.tearDown(self)
示例6: tearDown
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import tearDown [as 别名]
def tearDown(self):
for sock in self.sockets:
sock.close()
return TestCase.tearDown(self)
示例7: tearDown
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import tearDown [as 别名]
def tearDown(self):
rmtree(self.tempdir)
remove(self.tempfile)
TestCase.tearDown(self)
示例8: tearDown
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import tearDown [as 别名]
def tearDown(self):
self.ms.halt = True
TestCase.tearDown(self)
示例9: tearDown
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import tearDown [as 别名]
def tearDown(self):
self.reactor.shutdown()
self.reactor = None
TestCase.tearDown(self)
示例10: tearDown
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import tearDown [as 别名]
def tearDown(self):
TestCase.tearDown(self)
shutil.rmtree(self.store_dir)
示例11: tearDown
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import tearDown [as 别名]
def tearDown(self):
self.testbed.deactivate()
TestCase.tearDown(self)
示例12: tearDown
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import tearDown [as 别名]
def tearDown(self):
self.remove_folder_structure()
TestCase.tearDown(self)
示例13: tearDown
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import tearDown [as 别名]
def tearDown(self):
TestCase.tearDown(self)
if self.tempdir:
os.rmdir(self.tempdir)
setGadflyRoot()
示例14: tearDown
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import tearDown [as 别名]
def tearDown(self):
TestCase.tearDown(self)
self.rotatingFile.removeAllFiles()
self.rotatingFile.scanDirectory()
self.assertEqual(len(self.rotatingFile), 0)
示例15: tearDown
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import tearDown [as 别名]
def tearDown(self):
TestCase.tearDown(self)
gc.collect()
self.stop()