當前位置: 首頁>>代碼示例>>Python>>正文


Python coverage.process_startup方法代碼示例

本文整理匯總了Python中coverage.coverage.process_startup方法的典型用法代碼示例。如果您正苦於以下問題:Python coverage.process_startup方法的具體用法?Python coverage.process_startup怎麽用?Python coverage.process_startup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在coverage.coverage的用法示例。


在下文中一共展示了coverage.process_startup方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: add_coverage

# 需要導入模塊: from coverage import coverage [as 別名]
# 或者: from coverage.coverage import process_startup [as 別名]
def add_coverage(self):
        try:
            sources = test_sections[self.section].includes
        except KeyError:
            sources = ['IPython']

        coverage_rc = ("[run]\n"
                       "data_file = {data_file}\n"
                       "source =\n"
                       "  {source}\n"
                      ).format(data_file=os.path.abspath('.coverage.'+self.section),
                               source="\n  ".join(sources))
        config_file = os.path.join(self.workingdir.name, '.coveragerc')
        with open(config_file, 'w') as f:
            f.write(coverage_rc)

        self.env['COVERAGE_PROCESS_START'] = config_file
        self.pycmd = "import coverage; coverage.process_startup(); " + self.pycmd 
開發者ID:thomasyimgit,項目名稱:leetcode,代碼行數:20,代碼來源:iptestcontroller.py

示例2: process_startup

# 需要導入模塊: from coverage import coverage [as 別名]
# 或者: from coverage.coverage import process_startup [as 別名]
def process_startup():
    """Call this at Python startup to perhaps measure coverage.

    If the environment variable COVERAGE_PROCESS_START is defined, coverage
    measurement is started.  The value of the variable is the config file
    to use.

    There are two ways to configure your Python installation to invoke this
    function when Python starts:

    #. Create or append to sitecustomize.py to add these lines::

        import coverage
        coverage.process_startup()

    #. Create a .pth file in your Python installation containing::

        import coverage; coverage.process_startup()

    """
    cps = os.environ.get("COVERAGE_PROCESS_START")
    if cps:
        cov = coverage(config_file=cps, auto_data=True)
        cov.start()
        cov._warn_no_data = False
        cov._warn_unimported_source = False


# A hack for debugging testing in subprocesses. 
開發者ID:RoseOu,項目名稱:flasky,代碼行數:31,代碼來源:control.py


注:本文中的coverage.coverage.process_startup方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。