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


Python sys._called_from_test方法代碼示例

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


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

示例1: _jit

# 需要導入模塊: import sys [as 別名]
# 或者: from sys import _called_from_test [as 別名]
def _jit(function):
    """
    Compile a function using a jit compiler.

    The function is always compiled to check errors, but is only used outside
    tests, so that code coverage analysis can be performed in jitted functions.

    The tests set sys._called_from_test in conftest.py.

    """
    import sys

    compiled = numba.jit(function)

    if hasattr(sys, '_called_from_test'):
        return function
    else:  # pragma: no cover
        return compiled 
開發者ID:vnmabus,項目名稱:dcor,代碼行數:20,代碼來源:_utils.py

示例2: setUpClass

# 需要導入模塊: import sys [as 別名]
# 或者: from sys import _called_from_test [as 別名]
def setUpClass(cls):
        "Initialise parts of wxGlade before individual tests starts"
        # set icon path back to the default default
        #config.icons_path = 'icons'

        # initialise wxGlade preferences and set some useful values
        common.init_preferences()
        config.preferences.autosave = False
        config.preferences.write_timestamp = False
        config.preferences.show_progress = False
        #config.version = '"faked test version"'

        # make e.g. the preview raise Exceptions
        config.testing = True

        # Determinate case and output directory
        cls.caseDirectory = os.path.join( os.path.dirname(__file__), cls.caseDirectory )
        cls.outDirectory  = os.path.join( os.path.dirname(__file__), cls.outDirectory )
        if not os.path.exists(cls.outDirectory): os.mkdir(cls.outDirectory)

        # disable bug dialogs
        sys._called_from_test = True 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:24,代碼來源:testsupport_new.py

示例3: pytest_configure

# 需要導入模塊: import sys [as 別名]
# 或者: from sys import _called_from_test [as 別名]
def pytest_configure(config):
    import sys

    sys._called_from_test = True 
開發者ID:simonw,項目名稱:datasette,代碼行數:6,代碼來源:conftest.py

示例4: pytest_configure

# 需要導入模塊: import sys [as 別名]
# 或者: from sys import _called_from_test [as 別名]
def pytest_configure(config):
    sys._called_from_test = True 
開發者ID:danijar,項目名稱:mindpark,代碼行數:4,代碼來源:conftest.py

示例5: pytest_configure

# 需要導入模塊: import sys [as 別名]
# 或者: from sys import _called_from_test [as 別名]
def pytest_configure(config):
    import sys
    sys._called_from_test = True 
開發者ID:vnmabus,項目名稱:dcor,代碼行數:5,代碼來源:conftest.py

示例6: pytest_configure

# 需要導入模塊: import sys [as 別名]
# 或者: from sys import _called_from_test [as 別名]
def pytest_configure(config):
    """set pytest sentinel"""
    import sys
    sys._called_from_test = True 
開發者ID:KxSystems,項目名稱:pyq,代碼行數:6,代碼來源:conftest.py

示例7: pytest_unconfigure

# 需要導入模塊: import sys [as 別名]
# 或者: from sys import _called_from_test [as 別名]
def pytest_unconfigure(config):
    if hasattr(sys, '_called_from_test'):
        del sys._called_from_test 
開發者ID:coin-or,項目名稱:python-mip,代碼行數:5,代碼來源:conftest.py

示例8: pytest_configure

# 需要導入模塊: import sys [as 別名]
# 或者: from sys import _called_from_test [as 別名]
def pytest_configure(config):
    import sys

    sys._called_from_test = True
    config.addinivalue_line("markers", "example: Mark a given test as an example which can be run")
    config.addinivalue_line(
        "markers", "slow: Mark a given test as slower than most other tests, needing a special " "flag to run."
    ) 
開發者ID:MolSSI,項目名稱:QCFractal,代碼行數:10,代碼來源:testing.py


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