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


Python tests.logging_disabled函数代码示例

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


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

示例1: setUp

    def setUp(self):
        # create a FakeConsole parser
        parser_ini_conf = CfgConfigParser()
        parser_ini_conf.loadFromString(r'''''')
        self.parser_main_conf = MainConfig(parser_ini_conf)

        with logging_disabled():
            from b3.fake import FakeConsole
            self.console = FakeConsole(self.parser_main_conf)

        with logging_disabled():
            self.adminPlugin = AdminPlugin(self.console, '@b3/conf/plugin_admin.ini')
            self.adminPlugin._commands = {}
            self.adminPlugin.onStartup()

        # make sure the admin plugin obtained by other plugins is our admin plugin
        when(self.console).getPlugin('admin').thenReturn(self.adminPlugin)

        # create our plugin instance
        self.p = SpreePlugin(self.console, CfgConfigParser())

        with logging_disabled():
            from b3.fake import FakeClient

        self.mike = FakeClient(console=self.console, name="Mike", guid="MIKEGUID", groupBits=1)
        self.bill = FakeClient(console=self.console, name="Bill", guid="BILLGUID", groupBits=1)
开发者ID:82ndab-Bravo17,项目名称:big-brother-bot,代码行数:26,代码来源:__init__.py

示例2: setUp

    def setUp(self):
        with logging_disabled():
            # create a Iourt41 parser
            self.parser_conf = XmlConfigParser()
            self.parser_conf.loadFromString("""<configuration><settings name="server"><set name="game_log"></set></settings></configuration>""")
            self.console = Iourt41Parser(self.parser_conf)
            self.console.startup()

            # load the admin plugin
            if B3version(b3_version) >= B3version("1.10dev"):
                admin_plugin_conf_file = '@b3/conf/plugin_admin.ini'
            else:
                admin_plugin_conf_file = '@b3/conf/plugin_admin.xml'
            with logging_disabled():
                self.adminPlugin = AdminPlugin(self.console, admin_plugin_conf_file)
                self.adminPlugin.onStartup()

            # make sure the admin plugin obtained by other plugins is our admin plugin
            when(self.console).getPlugin('admin').thenReturn(self.adminPlugin)

            # when starting the PoweradminurtPlugin expects the game server to provide a few cvar values
            when(self.console).getCvar('timelimit').thenReturn(Cvar('timelimit', value=20))
            when(self.console).getCvar('g_maxGameClients').thenReturn(Cvar('g_maxGameClients', value=16))
            when(self.console).getCvar('sv_maxclients').thenReturn(Cvar('sv_maxclients', value=16))
            when(self.console).getCvar('sv_privateClients').thenReturn(Cvar('sv_privateClients', value=0))
            when(self.console).getCvar('g_allowvote').thenReturn(Cvar('g_allowvote', value=0))

            # prepare a few players
            self.joe = FakeClient(self.console, name="Joe", exactName="Joe", guid="zaerezarezar", groupBits=1, team=TEAM_UNKNOWN, teamId=0, squad=0)
            self.simon = FakeClient(self.console, name="Simon", exactName="Simon", guid="qsdfdsqfdsqf", groupBits=0, team=TEAM_UNKNOWN, teamId=0, squad=0)
            self.reg = FakeClient(self.console, name="Reg", exactName="Reg", guid="qsdfdsqfdsqf33", groupBits=4, team=TEAM_UNKNOWN, teamId=0, squad=0)
            self.moderator = FakeClient(self.console, name="Moderator", exactName="Moderator", guid="sdf455ezr", groupBits=8, team=TEAM_UNKNOWN, teamId=0, squad=0)
            self.admin = FakeClient(self.console, name="Level-40-Admin", exactName="Level-40-Admin", guid="875sasda", groupBits=16, team=TEAM_UNKNOWN, teamId=0, squad=0)
            self.superadmin = FakeClient(self.console, name="God", exactName="God", guid="f4qfer654r", groupBits=128, team=TEAM_UNKNOWN, teamId=0, squad=0)
开发者ID:thomasleveil,项目名称:b3-plugin-headshotsurt,代码行数:34,代码来源:__init__.py

示例3: setUp

    def setUp(self):
        self.parser_conf = MainConfig(CfgConfigParser(allow_no_value=True))
        self.parser_conf.loadFromString(dedent(r""""""))
        self.console = FakeConsole(self.parser_conf)
        self.console.gameName = 'f00'
        self.console.startup()

        with logging_disabled():
            self.adminPlugin = AdminPlugin(self.console, '@b3/conf/plugin_admin.ini')
            self.adminPlugin.onLoadConfig()
            self.adminPlugin.onStartup()

        self.evt_queue = []

        # make sure the admin plugin obtained by other plugins is our admin plugin
        when(self.console).getPlugin('admin').thenReturn(self.adminPlugin)

        with logging_disabled():
            from b3.fake import FakeClient

        # prepare a few players
        self.mike = FakeClient(self.console, name="Mike", exactName="Mike", guid="MIKEGUID", groupBits=16, ip='1.1.1.1')
        self.paul = FakeClient(self.console, name="Paul", exactName="Paul", guid="PAULGUID", groupBits=1, ip='2.2.2.2')
        self.john = FakeClient(self.console, name="John", exactName="John", guid="JOHNGUID", groupBits=0, ip='3.3.3.3')
        self.mary = FakeClient(self.console, name="Mary", exactName="Mary", guid="MARYGUID", groupBits=0, ip='4.4.4.4')

        self.conf = CfgConfigParser()
        self.p = IpbanPlugin(self.console, self.conf)

        # return some mock data
        when(self.p).getBanIps().thenReturn(['2.2.2.2', '6.6.6.6', '7.7.7.7'])
        when(self.p).getTempBanIps().thenReturn(['3.3.3.3', '8.8.8.8', '9.9.9.9'])
开发者ID:HaoDrang,项目名称:big-brother-bot,代码行数:32,代码来源:__init__.py

示例4: setUp

    def setUp(self):
        with logging_disabled():
            # create a Iourt41 parser
            self.parser_conf = XmlConfigParser()
            self.parser_conf.loadFromString("""<configuration><settings name="server"><set name="game_log"></set></settings></configuration>""")
            self.console = Iourt42Parser(self.parser_conf)
            self.console.startup()

            # load the admin plugin
            if B3version(b3_version) >= B3version("1.10dev"):
                admin_plugin_conf_file = '@b3/conf/plugin_admin.ini'
            else:
                admin_plugin_conf_file = '@b3/conf/plugin_admin.xml'
            with logging_disabled():
                self.adminPlugin = AdminPlugin(self.console, admin_plugin_conf_file)
                self.adminPlugin.onLoadConfig()
                self.adminPlugin.onStartup()

            # make sure the admin plugin obtained by other plugins is our admin plugin
            when(self.console).getPlugin('admin').thenReturn(self.adminPlugin)

            # prepare a few players
            from b3.fake import FakeClient
            self.joe = FakeClient(self.console, name="Joe", exactName="Joe", guid="zaerezarezar", groupBits=1, team=TEAM_UNKNOWN, teamId=0, squad=0)
            self.simon = FakeClient(self.console, name="Simon", exactName="Simon", guid="qsdfdsqfdsqf", groupBits=0, team=TEAM_UNKNOWN, teamId=0, squad=0)
            self.reg = FakeClient(self.console, name="Reg", exactName="Reg", guid="qsdfdsqfdsqf33", groupBits=4, team=TEAM_UNKNOWN, teamId=0, squad=0)
            self.moderator = FakeClient(self.console, name="Moderator", exactName="Moderator", guid="sdf455ezr", groupBits=8, team=TEAM_UNKNOWN, teamId=0, squad=0)
            self.admin = FakeClient(self.console, name="Level-40-Admin", exactName="Level-40-Admin", guid="875sasda", groupBits=16, team=TEAM_UNKNOWN, teamId=0, squad=0)
            self.superadmin = FakeClient(self.console, name="God", exactName="God", guid="f4qfer654r", groupBits=128, team=TEAM_UNKNOWN, teamId=0, squad=0)
开发者ID:danielepantaleone,项目名称:b3-plugin-poweradminurt,代码行数:29,代码来源:__init__.py

示例5: setUp

    def setUp(self):
        super(Test_autoassign, self).setUp()
        self.conf = CfgConfigParser()
        self.conf.loadFromString("""
[preferences]
no_autoassign_level: 20
autoassign: On
team_swap_threshold: 2
        """)
        with logging_disabled():
            self.p = Poweradminbf3Plugin(self.console, self.conf)
            self.p.onLoadConfig()
            self.p.onStartup()
        self.assertTrue(self.p._autoassign)
        self.assertEqual(20, self.p._no_autoassign_level)

        def my_write(data):
            if data[0] == 'admin.movePlayer':
                self.console.routeFrostbitePacket(['player.onTeamChange', data[1], data[2], data[3]])
                return ['OK']
            else:
                return Mock()

        self.write_patcher = patch.object(self.console, "write", side_effect=my_write)
        self.write_mock = self.write_patcher.start()
开发者ID:thomasleveil,项目名称:b3-plugin-poweradminbf3,代码行数:25,代码来源:test_team_swap_threshold.py

示例6: setUp

    def setUp(self):
        """
        This method is called before each test.
        It is meant to set up the SUT (System Under Test) in a manner that will ease the testing of its features.
        """
        with logging_disabled():
            # The B3TestCase class provides us a working B3 environment that does not require any database connexion.
            # The B3 console is then accessible with self.console
            B3TestCase.setUp(self)

            # set additional B3 console stuff that will be used by the XLRstats plugin
            self.console.gameName = "MyGame"
            self.parser_conf.add_section('b3')
            self.parser_conf.set('b3', 'time_zone', 'GMT')

            # we make our own AdminPlugin and make sure it is the one return in any case
            self.adminPlugin = AdminPlugin(self.console, DEFAULT_ADMIN_CONFIG_FILE)
            when(self.console).getPlugin("admin").thenReturn(self.adminPlugin)
            self.adminPlugin.onLoadConfig()
            self.adminPlugin.onStartup()

            # We need a config for the Xlrstats plugin
            self.conf = CfgConfigParser()  # It is an empty config but we can fill it up later

            # Now we create an instance of the SUT (System Under Test) which is the XlrstatsPlugin
            self.p = XlrstatsPlugin(self.console, self.conf)
            when(self.console).getPlugin("xlrstats").thenReturn(self.p)

            # create a client object to represent the game server
            with patch("b3.clients.Clients.authorizeClients"):  # we patch authorizeClients or it will spawn a thread
                # with a 5 second timer
                self.console.clients.newClient(-1, name="WORLD", guid="WORLD", hide=True)
开发者ID:82ndab-Bravo17,项目名称:big-brother-bot,代码行数:32,代码来源:test_xlrstats.py

示例7: setUp

    def setUp(self):
        CalladminTestCase.setUp(self)
        self.conf = CfgConfigParser()
        self.conf.loadFromString(dedent(r"""
            [teamspeak]
            ip: 127.0.0.1
            port: 10011
            serverid: 1
            username: fakeusername
            password: fakepassword
            msg_groupid: -1

            [settings]
            treshold: 3600
            useirc: no

            [commands]
            calladmin: user
        """))

        self.p = CalladminPlugin(self.console, self.conf)
        self.p.onLoadConfig()
        self.p.onStartup()

        with logging_disabled():
            from b3.fake import FakeClient

        self.mike = FakeClient(console=self.console, name="Mike", guid="mikeguid", groupBits=1)
        self.bill = FakeClient(console=self.console, name="Bill", guid="billguid", groupBits=16)
开发者ID:danielepantaleone,项目名称:b3-plugin-calladmin,代码行数:29,代码来源:test_events.py

示例8: setUp

 def setUp(self):
     Bf3TestCase.setUp(self)
     self.conf = CfgConfigParser()
     with logging_disabled():
         self.p = Poweradminbf3Plugin(self.console, self.conf)
     when(self.console).write(('vars.roundStartPlayerCount',)).thenReturn(['0'])
     self.scrambleTeams_mock = self.p._scrambler.scrambleTeams = Mock(name="scrambleTeams", wraps=self.p._scrambler.scrambleTeams)
     self.scrambleTeams_mock.reset_mock()
开发者ID:thomasleveil,项目名称:b3-plugin-poweradminbf3,代码行数:8,代码来源:test_scrambler.py

示例9: setUp

    def setUp(self):
        B3TestCase.setUp(self)
        logging.getLogger('output').setLevel(logging.DEBUG)
        with logging_disabled():
            self.console.startup()
            self.conf = CfgConfigParser()
            self.p = ChatloggerPlugin(self.console, self.conf)

        ## prepare the mysql test database
        db = MySQLdb.connect(host=MYSQL_TEST_HOST, user=MYSQL_TEST_USER, passwd=MYSQL_TEST_PASSWORD)
        db.query("DROP DATABASE IF EXISTS %s" % MYSQL_TEST_DB)
        db.query("CREATE DATABASE %s CHARACTER SET utf8;" % MYSQL_TEST_DB)

        self.console.storage = DatabaseStorage(
            'mysql://%s:%[email protected]%s/%s' % (MYSQL_TEST_USER, MYSQL_TEST_PASSWORD, MYSQL_TEST_HOST, MYSQL_TEST_DB), self.console)
        self.console.storage.executeSql("@b3/sql/b3.sql")
        self.console.storage.executeSql(CHATLOGGER_SQL_FILE)

        when(self.console.config).get('b3', 'time_zone').thenReturn('GMT')
        self.p.setup_fileLogger = Mock()

        self.conf.loadFromString(dedent("""
            [general]
            save_to_database: Yes
            save_to_file: no

            [file]
            logfile: @conf/chat.log
            rotation_rate: D

            [purge]
            max_age: 0
            hour: 0
            min: 0
        """))
        with logging_disabled():
            self.p.onLoadConfig()
            self.p.onStartup()
            self.joe = FakeClient(self.console, name="Joe", guid="joe_guid", team=TEAM_RED)
            self.simon = FakeClient(self.console, name="Simon", guid="simon_guid", team=TEAM_BLUE)
            self.joe.connects(1)
            self.simon.connects(3)

        self.assertEqual(0, self.count_chatlog_lines())
        self.assertEqual(0, self.count_cmdlog_lines())
开发者ID:ChrisNolan1992,项目名称:b3-plugin-chatlogger,代码行数:45,代码来源:test_mysql.py

示例10: setUp

    def setUp(self):
        ChatloggerTestCase.setUp(self)
        with logging_disabled():
            self.console.startup()

        self.conf = CfgConfigParser()
        self.p = ChatloggerPlugin(self.console, self.conf)

        when(self.console.config).get('b3', 'time_zone').thenReturn('GMT')
        self.p.setup_fileLogger = Mock()
开发者ID:HaoDrang,项目名称:big-brother-bot,代码行数:10,代码来源:test_config.py

示例11: setUp

 def setUp(self):
     with logging_disabled():
         CustomcommandsTestCase.setUp(self)
         self.conf = CfgConfigParser()
         self.p = CustomcommandsPlugin(self.console, self.conf)
         self.guest = FakeClient(console=self.console, name="Guest", guid="GuestGUID", pbid="GuestPBID", group_bits=0)
         self.player1 = FakeClient(console=self.console, name="player1", guid="player1GUID", pbid="player1PBID", group_bits=1)
         self.player1.connects(cid="CID1")
         self.player2 = FakeClient(console=self.console, name="player2", guid="player2GUID", pbid="player2PBID", group_bits=1)
         self.player2.connects(cid="CID2")
         self.guest.connects(cid="guestCID")
开发者ID:buildsample,项目名称:matrix-plugin,代码行数:11,代码来源:test_find_player.py

示例12: setUp

    def setUp(self):
        Bf4TestCase.setUp(self)
        self.conf = CfgConfigParser()
        self.conf.loadFromString("""[commands]
endround: 20
        """)
        with logging_disabled():
            self.p = Poweradminbf4Plugin(self.console, self.conf)
            self.p.onLoadConfig()
            self.p.onStartup()
            self.superadmin.connects('superadmin')
开发者ID:ArtRichards,项目名称:b3-plugin-poweradminbf4,代码行数:11,代码来源:test_cmd_endround.py

示例13: setUp

    def setUp(self):
        Bf4TestCase.setUp(self)
        self.conf = CfgConfigParser()
        self.conf.loadFromString("""[commands]
vipload: 20
        """)
        with logging_disabled():
            self.p = Poweradminbf4Plugin(self.console, self.conf)
            self.p.onLoadConfig()
            self.p.onStartup()
            self.moderator.connects("moderator")
开发者ID:ArtRichards,项目名称:b3-plugin-poweradminbf4,代码行数:11,代码来源:test_cmd_vipload.py

示例14: setUp

    def setUp(self):

        UrtauthTestCase.setUp(self)

        with logging_disabled():
            from b3.fake import FakeClient

        # create some clients
        self.mike = FakeClient(console=self.console, name="Mike", guid="mikeguid", groupBits=1)
        self.mark = FakeClient(console=self.console, name="Mark", guid="markguid", groupBits=1, pbid='markguid')
        self.bill = FakeClient(console=self.console, name="Bill", guid="billguid", groupBits=2)
        self.npc = FakeClient(console=self.console, name="NPC", guid="NPCGUID", groupBits=0, bot=True)
开发者ID:danielepantaleone,项目名称:b3-plugin-urtauth,代码行数:12,代码来源:test_events.py

示例15: setUp

    def setUp(self):
        JumperTestCase.setUp(self)
        with logging_disabled():
            from b3.fake import FakeClient

        # create some clients
        self.mike = FakeClient(console=self.console, name="Mike", guid="mikeguid", team=TEAM_FREE, groupBits=1)
        self.bill = FakeClient(console=self.console, name="Bill", guid="billguid", team=TEAM_FREE, groupBits=1)
        self.mike.connects("1")
        self.bill.connects("2")

        # force fake mapname
        self.console.game.mapName = 'ut42_bstjumps_u2'
开发者ID:82ndab-Bravo17,项目名称:big-brother-bot,代码行数:13,代码来源:test_events.py


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