• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python testing.tearDown函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyramid.testing.tearDown函数的典型用法代码示例。如果您正苦于以下问题:Python tearDown函数的具体用法?Python tearDown怎么用?Python tearDown使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了tearDown函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
开发者ID:IMIO,项目名称:imio.webservice.json,代码行数:7,代码来源:base.py


示例2: tearDown

    def tearDown():  # noqa
        testing.tearDown()

        from c2cgeoportal.models import DBSession, Shorturl
        import transaction
        DBSession.query(Shorturl).delete()
        transaction.commit()
开发者ID:camptocamp,项目名称:c2cgeoportal,代码行数:7,代码来源:test_shortener.py


示例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()
开发者ID:Happystation,项目名称:horus,代码行数:7,代码来源:__init__.py


示例4: 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()
开发者ID:xydinesh,项目名称:euwe,代码行数:7,代码来源:tests.py


示例5: tearDown

    def tearDown(self):

        print ('TearDown')
        testing.tearDown()
        self.trans.rollback()
        self.DBSession.rollback()
        self.DBSession.close()
开发者ID:JWepi,项目名称:NsPortal,代码行数:7,代码来源:tests.py


示例6: 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()
开发者ID:afsana1010,项目名称:sacrud,代码行数:7,代码来源:__init__.py


示例7: tearDown

    def tearDown(self):
        import transaction
        from shootout.models import DBSession

        transaction.abort()
        DBSession.remove()
        testing.tearDown()
开发者ID:krish14,项目名称:VimProject,代码行数:7,代码来源:test_views.py


示例8: 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()
开发者ID:ant30,项目名称:pyramid_sna,代码行数:7,代码来源:test_facebook.py


示例9: tearDown

 def tearDown(self):
     """
     clean up after a test case
     """
     DBSession.close()
     DBSession.remove()
     testing.tearDown()
开发者ID:ebora,项目名称:c3sMembership,代码行数:7,代码来源:test_utils.py


示例10: 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()
开发者ID:glinscott,项目名称:fishtest,代码行数:7,代码来源:test_users.py


示例11: 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 = {}
开发者ID:bbinet,项目名称:CheesePrism,代码行数:7,代码来源:test_views.py


示例12: tearDown

 def tearDown(self):
     """
     Close the transaction and rollback after each test case is called
     """
     testing.tearDown()
     self.transaction.rollback()
     self.session.close()
开发者ID:rwilkins87,项目名称:cogent-house,代码行数:7,代码来源:base.py


示例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
开发者ID:adroullier,项目名称:nive,代码行数:7,代码来源:test_view.py


示例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()
开发者ID:Dr-Rakcha,项目名称:stalker-pyramid,代码行数:7,代码来源:test_version.py


示例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()
开发者ID:Gandi,项目名称:pyramid_kvs,代码行数:25,代码来源:test_session.py


示例16: test_backup

def test_backup(dbsession, ini_settings):
    """Execute backup script with having our settings content."""

    f = NamedTemporaryFile(delete=False)
    temp_fname = f.name
    f.close()

    ini_settings["websauna.backup_script"] = "websauna.tests:backup_script.bash"
    ini_settings["backup_test.filename"] = temp_fname

    # We have some scoping issues with the dbsession here, make sure we close transaction at the end of the test
    with transaction.manager:

        init = get_init(dict(__file__=ini_settings["_ini_file"]), ini_settings)
        init.run()

        testing.setUp(registry=init.config.registry)

        # Check we have faux AWS variable to export
        secrets = get_secrets(get_current_registry())
        assert "aws.access_key_id" in secrets

        try:

            # This will run the bash script above
            backup_site()

            # The result should be generated here
            assert os.path.exists(temp_fname)
            contents = io.open(temp_fname).read()

            # test-secrets.ini, AWS access key
            assert contents.strip() == "foo"
        finally:
            testing.tearDown()
开发者ID:LukeSwart,项目名称:websauna,代码行数:35,代码来源:test_backup.py


示例17: test_should_renew_session_on_invalidate

    def test_should_renew_session_on_invalidate(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': '{"stuffing": "chocolate"}'
        }
        request = testing.DummyRequest(cookies={'SessionId': 'chocolate'})
        session = factory(request)

        # Ensure session is initialized
        self.assertEqual(session['stuffing'], 'chocolate')
        # Invalidate session
        session.invalidate()
        # session is invalidated
        self.assertFalse('stuffing' in session)
        # ensure it can be reused immediately
        session['stuffing'] = 'macadamia'
        self.assertEqual(session['stuffing'], 'macadamia')
        testing.tearDown()
开发者ID:Gandi,项目名称:pyramid_kvs,代码行数:26,代码来源:test_session.py


示例18: tearDown

 def tearDown(self):
     import twill
     import twill.commands
     twill.commands.reset_browser()
     twill.remove_wsgi_intercept('localhost', 6543)
     twill.set_output(None)
     testing.tearDown()
开发者ID:markramm,项目名称:pyramid,代码行数:7,代码来源:test_integration.py


示例19: tearDown

	def tearDown(self):
		import transaction
		from .models.meta import DBSession
		
		transaction.abort()
		DBSession.remove()
		testing.tearDown()
开发者ID:riggtravis,项目名称:SINS,代码行数:7,代码来源:tests.py


示例20: tearDown

    def tearDown():  # noqa
        testing.tearDown()

        import transaction
        from c2cgeoportal.models import FullTextSearch, User, Role, Interface
        from c2cgeoportal.models import DBSession

        DBSession.query(User).filter(User.username == "__test_user1").delete()
        DBSession.query(User).filter(User.username == "__test_user2").delete()

        DBSession.query(FullTextSearch).filter(
            FullTextSearch.label == "label1").delete()
        DBSession.query(FullTextSearch).filter(
            FullTextSearch.label == "label2").delete()
        DBSession.query(FullTextSearch).filter(
            FullTextSearch.label == "label3").delete()
        DBSession.query(FullTextSearch).filter(
            FullTextSearch.label == "label4").delete()
        DBSession.query(FullTextSearch).filter(
            FullTextSearch.label == "label5").delete()
        DBSession.query(FullTextSearch).filter(
            FullTextSearch.label == "label6").delete()

        DBSession.query(Interface).filter(
            Interface.name == "main").delete()

        DBSession.query(Role).filter(Role.name == "__test_role1").delete()
        DBSession.query(Role).filter(Role.name == "__test_role2").delete()

        transaction.commit()
开发者ID:camptocamp,项目名称:c2cgeoportal,代码行数:30,代码来源:test_fulltextsearch.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python testing.testConfig函数代码示例发布时间:2022-05-27
下一篇:
Python testing.setUp函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap