本文整理匯總了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
示例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
示例3: pytest_configure
# 需要導入模塊: import sys [as 別名]
# 或者: from sys import _called_from_test [as 別名]
def pytest_configure(config):
import sys
sys._called_from_test = True
示例4: pytest_configure
# 需要導入模塊: import sys [as 別名]
# 或者: from sys import _called_from_test [as 別名]
def pytest_configure(config):
sys._called_from_test = True
示例5: pytest_configure
# 需要導入模塊: import sys [as 別名]
# 或者: from sys import _called_from_test [as 別名]
def pytest_configure(config):
import sys
sys._called_from_test = True
示例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
示例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
示例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."
)