本文整理汇总了Python中pyramid.testing.tearDown函数的典型用法代码示例。如果您正苦于以下问题:Python tearDown函数的具体用法?Python tearDown怎么用?Python tearDown使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tearDown函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tearDown
def tearDown(self):
DBSession.rollback()
testing.tearDown()
security.unauthenticated_userid = self._unauthenticated_userid
FileUpload.save_tmpfile = self._save_tmpfile
FileUpload.move = self._move
FileUpload.save_reference = self._save_reference
示例2: tearDown
def tearDown(): # noqa
testing.tearDown()
from c2cgeoportal.models import DBSession, Shorturl
import transaction
DBSession.query(Shorturl).delete()
transaction.commit()
示例3: tearDown
def tearDown(self):
# rollback - everything that happened with the
# Session above (including calls to commit())
# is rolled back.
testing.tearDown()
self.trans.rollback()
self.session.close()
示例4: tearDown
def tearDown(self):
"""
clean up after a test case
"""
DBSession.close()
DBSession.remove()
testing.tearDown()
示例5: tearDown
def tearDown(self):
"""
Close the transaction and rollback after each test case is called
"""
testing.tearDown()
self.transaction.rollback()
self.session.close()
示例6: tearDown
def tearDown(self):
if self.id == None:
res = self.testapp.delete(url='/delete/{0}'.format(self.id))
import logging
logging.debug('delete {0}'.format(self.id))
self.id = None
testing.tearDown()
示例7: tearDown
def tearDown(self):
print ('TearDown')
testing.tearDown()
self.trans.rollback()
self.DBSession.rollback()
self.DBSession.close()
示例8: tearDown
def tearDown(self):
def clear_files():
for filename in glob.glob("%s/*.html" % (PHOTO_PATH, )):
os.remove(os.path.join(PHOTO_PATH, filename))
clear_files()
self.session.remove()
testing.tearDown()
示例9: tearDown
def tearDown(self):
import transaction
from shootout.models import DBSession
transaction.abort()
DBSession.remove()
testing.tearDown()
示例10: test_incomplete_config3
def test_incomplete_config3(self):
config = testing.setUp(settings={
'facebook_app_id': '123',
'facebook_app_secret': 's3cr3t',
})
self.assertFalse(include_facebook(config))
testing.tearDown()
示例11: tearDown
def tearDown(self):
self.request.userdb.users.delete_many({'username': 'JoeUser'})
self.request.userdb.user_cache.delete_many({'username': 'JoeUser'})
# Shutdown flush thread:
global rundb
rundb.stop()
testing.tearDown()
示例12: tearDown
def tearDown(self):
self.event_results = None
testing.tearDown()
if CPDummyRequest.test_dir is not None:
CPDummyRequest.test_dir.rmtree()
CPDummyRequest.test_dir = None
CPDummyRequest._index_data = {}
示例13: tearDown
def tearDown(self):
user = User(u"test")
r = self.app.root()
r.Delete(self.context.id, user=user)
r.Delete(self.context2.id, user=user)
testing.tearDown()
pass
示例14: tearDown
def tearDown(self):
os.rmdir(self.test_repo.linux_path)
os.rmdir(self.test_repo.windows_path)
os.rmdir(self.test_repo.osx_path)
DBSession.remove()
testing.tearDown()
示例15: test_cookie
def test_cookie(self):
settings = {'pyramid.includes': '\n pyramid_kvs.testing',
'kvs.session': """{"kvs": "mock",
"key_name": "SessionId",
"session_type": "cookie",
"codec": "json",
"key_prefix": "cookie::",
"ttl": 20}"""}
testing.setUp(settings=settings)
factory = SessionFactory(settings)
MockCache.cached_data = {
b'cookie::chocolate': '{"anotherkey": "another val"}'
}
self.assertEqual(factory.session_class, CookieSession)
request = testing.DummyRequest(cookies={'SessionId': 'chocolate'})
session = factory(request)
client = session.client
self.assertIsInstance(client, MockCache)
self.assertEqual(client._serializer.dumps, serializer.json.dumps)
self.assertEqual(client.ttl, 20)
self.assertEqual(client.key_prefix, b'cookie::')
self.assertEqual(session['anotherkey'], 'another val')
self.assertEqual(request.response_callbacks,
deque([session.save_session]))
testing.tearDown()