python类tearDown()的实例源码

tests.py 文件源码 项目:pyramid-zappa-api-boilerplate 作者: web-masons 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def tearDown(self):
        from .models.meta import Base

        testing.tearDown()
        transaction.abort()
        Base.metadata.drop_all(self.engine)
tests.py 文件源码 项目:talk-python-search-service 作者: mikeckennedy 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def tearDown(self):
        testing.tearDown()
tests.py 文件源码 项目:safe_giveaway 作者: Jeremydavisvt 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def tearDown(self):
        DBSession.remove()
        testing.tearDown()
tests.py 文件源码 项目:safe_giveaway 作者: Jeremydavisvt 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def tearDown(self):
        DBSession.remove()
        testing.tearDown()
tests.py 文件源码 项目:annotran 作者: BirkbeckCTP 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def tearDown(self):
        testing.tearDown()
home_test.py 文件源码 项目:work4la 作者: alexchao 项目源码 文件源码 阅读 75 收藏 0 点赞 0 评论 0
def tearDown(self):
        testing.tearDown()
tests.py 文件源码 项目:pyramidVue 作者: eddyekofo94 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def tearDown(self):
        testing.tearDown()
test_csrf.py 文件源码 项目:websauna 作者: websauna 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def csrf_app(request):
    """py.test fixture to set up a dummy app for CSRF testing.

    :param request: pytest's FixtureRequest (internal class, cannot be hinted on a signature)
    """

    session = DummySession()

    config = testing.setUp()
    config.set_default_csrf_options(require_csrf=True)
    config.add_route("home", "/")
    config.add_route("csrf_sample", "/csrf_sample")
    config.add_route("csrf_exempt_sample", "/csrf_exempt_sample")
    config.add_route("csrf_exempt_sample_context", "/csrf_exempt_sample_context")
    config.add_route("csrf_sample_double_argument", "/csrf_sample_double_argument/{arg}")
    config.add_route("csrf_exempt_sample_double_argument", "/csrf_exempt_sample_double_argument/{arg}")
    config.scan(csrfsamples)

    # We need sessions in order to use CSRF feature

    def dummy_session_factory(secret):
        # Return the same session over and over again
        return session

    config.set_session_factory(dummy_session_factory)

    def teardown():
        testing.tearDown()

    app = TestApp(config.make_wsgi_app())
    # Expose session data for tests to read
    app.session = session
    return app
test_backup.py 文件源码 项目:websauna 作者: websauna 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
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()
tests.py 文件源码 项目:assignment_aa 作者: RaHus 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def tearDown(self):
        from .models.meta import Base

        testing.tearDown()
        transaction.abort()
        Base.metadata.drop_all(self.engine)
tests.py 文件源码 项目:EDDB_JsonAPI 作者: FuelRats 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def tearDown(self):
        from .models.meta import Base

        testing.tearDown()
        transaction.abort()
        Base.metadata.drop_all(self.engine)
test_ajax_get_infos.py 文件源码 项目:dbas 作者: hhucn 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def tearDown(self):
        testing.tearDown()
test_view_discussion_reaction.py 文件源码 项目:dbas 作者: hhucn 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def tearDown(self):
        testing.tearDown()
        clear_seen_by_of('Tobias')
        clear_clicks_of('Tobias')
        clear_seen_by_of('Björn')
        clear_clicks_of('Björn')
test_view_main_settings.py 文件源码 项目:dbas 作者: hhucn 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def tearDown(self):
        testing.tearDown()
test_view_main_settings.py 文件源码 项目:dbas 作者: hhucn 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def tearDown(self):
        testing.tearDown()
test_view_main_settings.py 文件源码 项目:dbas 作者: hhucn 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def tearDown(self):
        testing.tearDown()
test_auth_oauth_google.py 文件源码 项目:dbas 作者: hhucn 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def tearDown(self):
        testing.tearDown()
test_view_discussion_finish.py 文件源码 项目:dbas 作者: hhucn 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def tearDown(self):
        testing.tearDown()
test_auth_ldap.py 文件源码 项目:dbas 作者: hhucn 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def tearDown(self):
        testing.tearDown()
test_ajax_review.py 文件源码 项目:dbas 作者: hhucn 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def tearDown(self):
        testing.tearDown()


问题


面经


文章

微信
公众号

扫码关注公众号