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

Python teamcity.is_running_under_teamcity函数代码示例

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

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



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

示例1: configure

    def configure(self, options, conf):
        self.enabled = is_running_under_teamcity()
        self.config = conf

        if self._capture_plugin_enabled():
            capture_plugin = self._get_capture_plugin()

            old_before_test = capture_plugin.beforeTest
            old_after_test = capture_plugin.afterTest
            old_format_error = capture_plugin.formatError

            def newCaptureBeforeTest(test):
                rv = old_before_test(test)
                test_id = self.get_test_id(test)
                capture_plugin._buf = FlushingStringIO(lambda data: dump_test_stdout(self.messages, test_id, test_id, data))
                sys.stdout = capture_plugin._buf
                return rv

            def newCaptureAfterTest(test):
                if isinstance(capture_plugin._buf, FlushingStringIO):
                    capture_plugin._buf.flush()
                return old_after_test(test)

            def newCaptureFormatError(test, err):
                if isinstance(capture_plugin._buf, FlushingStringIO):
                    capture_plugin._buf.flush()
                return old_format_error(test, err)

            capture_plugin.beforeTest = newCaptureBeforeTest
            capture_plugin.afterTest = newCaptureAfterTest
            capture_plugin.formatError = newCaptureFormatError
开发者ID:JetBrains,项目名称:teamcity-messages,代码行数:31,代码来源:nose_report.py


示例2: pytest_runtest_teardown

def pytest_runtest_teardown(item: pytest.Item):
    '''Hook to run after every test.'''
    # Inject footer at end of test, may be followed by additional teardown.
    # Don't do this when running in teamcity, where it's redundant.
    if not teamcity.is_running_under_teamcity():
        print('''
==========
======= END: {}::{}
=========='''.format(sdk_diag.get_test_suite_name(item), item.name))
开发者ID:keithchambers,项目名称:dcos-commons,代码行数:9,代码来源:conftest.py


示例3: add_options

 def add_options(cls, parser):
     cls._add_option(parser,
                     '--teamcity',
                     default=is_running_under_teamcity(),
                     help="Force output of JetBrains TeamCity service messages")
     cls._add_option(parser,
                     '--no-teamcity',
                     default=False,
                     help="Disable output of JetBrains TeamCity service messages (even under TeamCity build)")
开发者ID:JetBrains,项目名称:teamcity-messages,代码行数:9,代码来源:flake8_v3_plugin.py


示例4: pytest_runtest_setup

def pytest_runtest_setup(item: pytest.Item):
    '''Hook to run before every test.'''
    # Inject header at start of test, following automatic "path/to/test_file.py::test_name":
    # Don't do this when running in teamcity, where it's redundant.
    if not teamcity.is_running_under_teamcity():
        print('''
==========
======= START: {}::{}
=========='''.format(sdk_diag.get_test_suite_name(item), item.name))

    if INTEGRATION_TEST_LOG_COLLECTION:
        sdk_diag.handle_test_setup(item)
    sdk_utils.check_dcos_min_version_mark(item)
开发者ID:keithchambers,项目名称:dcos-commons,代码行数:13,代码来源:conftest.py


示例5: main

def main():
    parser = argparse.ArgumentParser(description="Run cppcheck")
    parser.add_argument("--ac", type=str, help="Additional checks (default all)", default="all")
    parser.add_argument("--idir", type=str, help="Path of file with all include directories", default="include_directories.txt")
    parser.add_argument("--ip", type=argparse.FileType("r"), help="Path of file with directories to analyze", default="include_paths.txt")
    parser.add_argument("--idef", type=argparse.FileType("r"), help="Path of file with included definitions", default="include_defines.txt")
    parser.add_argument("--xp", type=argparse.FileType("r"), help="Path of file with directories or files to exclude from analysis", default="exclude_paths.txt")
    parser.add_argument("--xdef", type=argparse.FileType("r"), help="Path of file with definitions to exclude", default="exclude_defines.txt")
    parser.add_argument("--s", type=str, help="Path of file with warnings to suppress", default="suppressions.txt")
    parser.add_argument("--ot", type=str, help="The output template", default=None)
    parser.add_argument("--ext", type=str, help="Direct cppcheck arguments", default=None)

    # get all data from command line
    args = parser.parse_args()

    # if the output format is None identify whether under TC or not and set message format accordingly
    # if format set to TC will also need to escape messages
    if args.ot is None:
        if teamcity.is_running_under_teamcity():
            args.ot = "tc"
        else:
            args.ot = "vs"

    arguments = " --inline-suppr --error-exitcode=-1 --inconclusive --force" + \
                " --enable=" + args.ac + \
                ("" if args.ext is None else " " + args.ext) + \
                create_exclude_defines_argument(args.xdef) + \
                create_include_defines_argument(args.idef) + \
                create_include_paths_argument(args.ip) + \
                " --includes-file=" + args.idir + \
                create_exclude_paths_argument(args.xp) + \
                " --template=" + ('"##teamcity[buildProblem description=\'{file}:{line}: {severity} ({id}): {message}\']"' if args.ot == "tc" else args.ot) + \
                " --suppressions-list=" + args.s

    # run the process and redirect both stdout and stderr for further processing if needed
    if args.ot == "tc":
        process = subprocess.Popen(get_cppcheck_path() + arguments, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
        while True:
            more = handle_output_line(process.stdout.readline().decode())
            if not more:
                break
        return process.returncode
    else:
        return subprocess.call(get_cppcheck_path() + arguments)
开发者ID:alunegov,项目名称:teamcity_and_cppcheck,代码行数:44,代码来源:run_cppcheck.py


示例6: pytest_configure

def pytest_configure(config):
    if config.option.no_teamcity >= 1:
        enabled = False
    elif config.option.teamcity >= 1:
        enabled = True
    else:
        enabled = is_running_under_teamcity()

    if enabled:
        output_capture_enabled = getattr(config.option, 'capture', 'fd') != 'no'
        coverage_controller = _get_coverage_controller(config)
        skip_passed_output = bool(config.getini('skippassedoutput'))

        config._teamcityReporting = EchoTeamCityMessages(
            output_capture_enabled,
            coverage_controller,
            skip_passed_output,
            bool(config.getini('swapdiff'))
        )
        config.pluginmanager.register(config._teamcityReporting)
开发者ID:amaurymedeiros,项目名称:intellij-community,代码行数:20,代码来源:pytest_plugin.py


示例7: __init__

 def __init__(self):
     self.loggers = []
     if teamcity.is_running_under_teamcity():
         self.loggers.append(TeamcityServiceMessages())
     else:
         self.loggers.append(PrintLogger())
开发者ID:rlugojr,项目名称:dcos,代码行数:6,代码来源:util.py


示例8: TeamcityTestRunner

import sys
import unittest
try:
    from teamcity import is_running_under_teamcity
    from teamcity.unittestpy import TeamcityTestRunner
    runner = TeamcityTestRunner() if is_running_under_teamcity() else unittest.TextTestRunner()
except ImportError:
    runner = unittest.TextTestRunner()

from tests import ExampleTest


tests = {
    "ExampleTest": ExampleTest
}

if __name__ == "__main__":
    from application import application
    application.start_testing()
    test_name = sys.argv[1] if len(sys.argv) > 1 else None
    tests = tuple(
        [
            unittest.loader.findTestCases(tests[test_suit_name])
            for test_suit_name in tests
            if test_suit_name == test_name or not test_name
        ]
    )
    sys.exit(not runner.run(unittest.TestSuite(tests=tests)).wasSuccessful())
开发者ID:verteen,项目名称:z9,代码行数:28,代码来源:runtests.py


示例9: parse_options

 def parse_options(cls, options):
     if not options.no_teamcity:
         if options.teamcity or is_running_under_teamcity():
             options.format = 'teamcity-messages'
开发者ID:JetBrains,项目名称:teamcity-messages,代码行数:4,代码来源:flake8_v3_plugin.py


示例10: run_suite

 def run_suite(self, suite, **kwargs):
     if is_running_under_teamcity():
         return TeamcityTestRunner().run(suite)
     else:
         return unittest.TextTestRunner(
             verbosity=self.verbosity, failfast=self.failfast).run(suite)
开发者ID:srusskih,项目名称:django_teamcity_test_runner,代码行数:6,代码来源:__init__.py


示例11: main_func

def main_func():
    import argparse
    parser = argparse.ArgumentParser(description="Bandwidth Wars")
    parser.add_argument('--port',default=7171,type=int)
    parser.add_argument('--turn_max',default=5,help="The maximum time allocated per turn",type=int)
    parser.add_argument('--tokens',default=2,help="How many tokens should be generated for this game.",type=int)
    parser.add_argument('--open-play',dest='open_play',action='store_true',help="Whether the server allows just anyone to play.")
    parser.add_argument('--selftest',action='store_true',help="Run the tests.")
    parser.add_argument('--teamcity',action='store_true',help="Using teamcity.  Must be used with --selftest.  teamcity-messages must be installed.")
    parser.set_defaults(open_play=False)
    args = parser.parse_args()
    if args.selftest:
        import teamcity
        import teamcity.unittestpy
        import unittest
        if teamcity.is_running_under_teamcity() or args.teamcity:
            runner = teamcity.unittestpy.TeamcityTestRunner()
        else:
            runner = unittest.TextTestRunner(verbosity=2)
        import os.path
        directory = os.path.dirname(__file__)
        print "test directory",directory
        testsuite = unittest.TestLoader().discover(directory)
        runner.run(testsuite)
        return

    import models.game
    game = models.game.Game(max_interval=args.turn_max,tokens=args.tokens,open_play=args.open_play)

    from twisted.internet import protocol, reactor
    import twisted.protocols.basic

    class BW(twisted.protocols.basic.LineReceiver):

        def __init__(self):
            self.delimiter = '\n'
        def connectionMade(self):
            self.transport.write('{"msg":"Welcome to Bandwidth Wars","ver":0.1}\n')
        def lineReceived(self, data):
            if hasattr(self,"player"):
                player = self.player.gameToken
            else:
                player = "???"
            logging.debug("raw socket from %s> %s" % (player,data))
            result = game.process_raw_command(data, self)

            self.send_raw(result)

        def send_raw(self,data):
            if hasattr(self,"player") and self.player != None:
                player = self.player.gameToken
            else:
                player = "???"
            logging.debug("raw socket to %s> %s" % (player,data))
            self.transport.write(data+"\n")

    class BWFactory(protocol.Factory):
        def buildProtocol(self, addr):
            return BW()

    logging.info("Listening on port %d",args.port)
    reactor.listenTCP(args.port, BWFactory())
    reactor.run()
开发者ID:drewcrawford,项目名称:BandwidthWars,代码行数:63,代码来源:bandwidthwars.py


示例12: is_running_under_teamcity

import pep8

from teamcity.messages import TeamcityServiceMessages
from teamcity import __version__, is_running_under_teamcity


name = 'teamcity_stats'
version = __version__
enable_teamcity = is_running_under_teamcity()


def add_options(parser):
    parser.add_option('--teamcity_stats', default=False,
                      action='callback', callback=set_option_callback,
                      help="Enable teamcity stats messages")


def set_option_callback(option, opt, value, parser):
    global enable_teamcity
    enable_teamcity = True


def parse_options(options):
    if not enable_teamcity:
        return

    options.reporter = TeamcityStatisticsReport
    options.report = TeamcityStatisticsReport(options)
    options.jobs = None  # needs to be disabled, flake8 overrides the report if enabled

开发者ID:deti,项目名称:boss,代码行数:29,代码来源:flake8_plugin.py


示例13: ImportError

if sys.version_info[:2] >= (3, 3, ):
    from unittest import mock
else:
    try:
        import mock

    except ImportError:
        raise ImportError("The BatchApps Python Client test suite requires "
                          "the mock package to run on Python 3.2 and below.\n"
                          "Please install this package to continue.")

try:
    from teamcity import is_running_under_teamcity
    from teamcity.unittestpy import TeamcityTestRunner
    TC_BUILD = is_running_under_teamcity()

except ImportError:
    TC_BUILD = False

if __name__ == '__main__':

    if TC_BUILD:
        runner = TeamcityTestRunner()
    else:
        runner = TextTestRunner(verbosity=2)

    test_dir = os.path.dirname(__file__)
    top_dir = os.path.dirname(os.path.dirname(test_dir))
    test_loader = TestLoader()
    suite = test_loader.discover(test_dir,
开发者ID:Azure,项目名称:azure-batch-apps-python,代码行数:30,代码来源:__init__.py


示例14: run

def run(suite):
    if is_running_under_teamcity():
        runner = TeamcityTestRunner()
    else:
        runner = unittest.TextTestRunner()
    runner.run(suite)
开发者ID:dbr13,项目名称:itra,代码行数:6,代码来源:suite.py


示例15: configure

 def configure(self, options, conf):
     self.enabled = is_running_under_teamcity()
开发者ID:lewisc,项目名称:teamcity-python,代码行数:2,代码来源:nose_report.py


示例16: xml

            f.write(inflated)

        # Turn the inflated xml (which is just a string) into a in memory XML document
        doc = fromstring(inflated)

        # Verification of enveloped signature
        node = doc.find(".//{%s}Signature" % xmlsec.DSigNs)
        key_file = join(dirname(__file__), '..', '..', '..', 'certs/example.com', 'example.pubkey')

        dsigCtx = xmlsec.DSigCtx()

        signKey = xmlsec.Key.load(key_file, xmlsec.KeyDataFormatPem, None)
        signKey.name = 'example.pubkey'

        # Note: the assignment below effectively copies the key
        dsigCtx.signKey = signKey

        # Add ID attributes different from xml:id
        # See the Notes on https://pypi.python.org/pypi/dm.xmlsec.binding/1.3.2
        xmlsec.addIDs(doc, ["ID"])

        # This raises an exception if the document does not verify
        dsigCtx.verify(node)

if __name__ == '__main__':
    if is_running_under_teamcity():
        runner = TeamcityTestRunner()
    else:
        runner = unittest.TextTestRunner()
    unittest.main(testRunner=runner)
开发者ID:RegBinder,项目名称:python-saml,代码行数:30,代码来源:authn_request_test.py


示例17: open

    parser = argparse.ArgumentParser(description="Extracts information from Map files.")
    parser.add_argument("mapfile", help="Path to map file to parse.")
    parser.add_argument("--tc", help="Use TeamCity output.", action="store_true")
    parser.add_argument("--devname", help="Label for the chip executable")
    args = parser.parse_args()

    basename = os.path.basename(args.mapfile)
    if not args.devname:
        args.devname = basename.split(".")[0]

    logging.basicConfig(level=logging.DEBUG)
    with open(args.mapfile, 'r') as fobj:
        mapFile = MapFileHelper(fobj.read(), deviceName=args.devname)

    blockTable = (mapFile.placement.blockTable)
    objectTable = (mapFile.placement.objectTable)
    modTable = objectTable.pivot_table(values="size", 
        index=['kindMod', 'module'], aggfunc=np.sum)

    if args.tc or is_running_under_teamcity():
        # print(blockTable)
        # print(modTable)
        print(tc_buildStatistic(args.devname, "ro", "total", blockTable["P1"]["size"]))
        print(tc_buildStatistic(args.devname, "rw", "total", blockTable["P2"]["size"]))
        to_teamcity(modTable, args.devname)
    else:
        print(blockTable)
        print(modTable)


开发者ID:ktarrant,项目名称:mapfile,代码行数:28,代码来源:mapReport.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python messages.TeamcityServiceMessages类代码示例发布时间:2022-05-27
下一篇:
Python team.Team类代码示例发布时间: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